showing Error while running using Getx widget-Flutter - flutter

This error occurs only when I use get package. To Solve this problem, I deleted get folder from the .pub-cache/hosted/pub.dartlang.org destination and again imported it but nothing happened.
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:121:9:
Error: Type 'RouteInformationProvider' not found.
final RouteInformationProvider routeInformationProvider;
^^^^^^^^^^^^^^^^^^^^^^^^
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:122:9: Error: Type
'RouteInformationParser' not found.
final RouteInformationParser<Object> routeInformationParser;
^^^^^^^^^^^^^^^^^^^^^^
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:122:9: Error:
Expected 0 type arguments.
final RouteInformationParser<Object> routeInformationParser;
^
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:123:9: Error: Type
'RouterDelegate' not found.
final RouterDelegate<Object> routerDelegate;
^^^^^^^^^^^^^^
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_cupertino_app.dart:123:9: Error:
Expected 0 type arguments.
final RouterDelegate<Object> routerDelegate;
^
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_material_app.dart:130:9: Error:
Expected 0 type arguments.
final RouteInformationParser<Object> routeInformationParser;
^^^^^^^^^^^^^^
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_material_app.dart:132:9: Error: '
BackButtonDispatcher' isn't a type.
final BackButtonDispatcher backButtonDispatcher;
^^^^^^^^^^^^^^^^^^^^
/D:/Flutter/.pub-cache/hosted/pub.dartlang.org/get-3.25.4/lib/
get_navigation/src/root/get_material_app.dart:245:25: Error:
Method not found: 'MaterialApp.router'.
? MaterialApp.router(
^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\Flutter\packages\flutter_tools\gradle\flutter.gradle'
line: 896
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\Flutter\bin\flutter.bat'' finished with non
-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --
info or --debug option to get more log output. Run with --scan to
get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 22s
Exception: Gradle task assembleDebug failed with exit code 1
I Used many other packages but the error occurred only when using get package.

open your android studio terminal
1 - clean your project
flutter clean
2 - change flutter channel to stable
Flutter channels:
master
dev
beta
* stable
make sure you are on a stable channel
3 - now you need to make upgrade flutter upgrade (on the terminal)
flutter upgrade
output
Flutter is already up to date on channel stable
Flutter 2.0.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision c5a4b4029c (2 days ago) • 2021-03-04 09:47:48 -0800
Engine • revision 40441def69
Tools • Dart 2.12.0
4 - make clean again
flutter clean
if you on flutter 2 then all is well :)

Related

Flutter: Icon works locally but fails android driver test: Error: Member not found: 'airline_stops'

I'm trying to use the icon "Icons.airline_stops" that can be found on the flutter website https://api.flutter.dev/flutter/material/Icons/airline_stops-constant.html
When I compile it on my local emulator, it displays correctly as I want. However, when I do a commit and the android drive test are run, it fails.
drive_android (Failed)
drive_ios (Success)
Problematic line in the error:
lib/external_projects/project1/screens/finish_experiment.dart:71:23: Error: Member not found: 'airline_stops'.
Icons.airline_stops,
^^^^^^^^^^^^^
If I change this icon to another one, the android drive test passes successfully. But I'd like to use this one and since it's in the flutter.dev website it should work...
Complete error log:
Running "flutter pub get" in flutter_tools... WARNING | /etc/localtime does not point to zoneinfo-compatible timezone name
5.4s
Running "flutter pub get" in my_project... 36.4s
Running Gradle task 'assembleDebug'...
[flutter_background_geolocation] Purging debug resources in release build
lib/external_projects/project1/screens/finish_experiment.dart:71:23: Error: Member not found: 'airline_stops'.
Icons.airline_stops,
^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script '/Users/runner/hostedtoolcache/flutter/2.8.1-stable/x64/packages/flutter_tools/gradle/flutter.gradle' line: 1070
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/runner/hostedtoolcache/flutter/2.8.1-stable/x64/bin/flutter'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 18s
Running Gradle task 'assembleDebug'... 140.9s
Gradle task assembleDebug failed with exit code 1
Error: The process '/bin/sh' failed with exit code 1
Terminate Emulator
INFO | Discarding the changed state: command-line flag
WARNING | Discarding the changed state (command-line flag).
INFO | Shutting down gRPC endpoint
INFO | Shutting down gRPC endpoint
Solution:
The virtual machine flutter version used to run drive_android tests has to be updated to match the flutter version.
Explanation:
In this case, my flutter versions were as follows:
Local device: Flutter 2.10.5
drive_android: Flutter 2.8.1
drive_ios: Flutter 2.10.0
The icon Icon.airline_stops was probably introduced in a flutter version older than 2.8.1, that's the reason why it failed drive_android but passed both the local device (that is using Android) and the drive_ios tests.
Therefore, to solve this all versions must be updated to match the local device. And, why not update drive_ios too to avoid something similar happening in the future?
Local device: Flutter 2.10.5
drive_android: Flutter 2.8.1 -> 2.10.5
drive_ios: Flutter 2.10.0 -> 2.10.5

Error: No named parameter with the name 'nullOk'. after updating to FLutter 2.0

I updated my App to the latest version of the Flutter.
E:\anmol\Jan' 2021 -Backup\nemar_user_(for_new_packages)>flutter --version
Flutter 2.0.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 4d7946a68d (3 days ago) • 2021-03-18 17:24:33 -0700
Engine • revision 3459eb2436
Tools • Dart 2.12.2
Along with that, I upgraded new packages in pubspec.yaml
When I run my app, then it shows the following errors, I tried so many things but nothing Works. Any Kind of Help would be appreciated.
/E:/flutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/expandable_text-1.3.2/lib/expandable_text.dart:153:56: Error: No named parameter with the name 'nullOk'.
final locale = Localizations.localeOf(context, nullOk: true);
^^^^^^
/E:/flutterSDK/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
static Locale localeOf(BuildContext context) {
^^^^^^^^
FAILURE: Build failed with an exception.
Where:
Script 'E:\flutterSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'E:\flutterSDK\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 46s
Exception: Gradle task assembleDebug failed with exit code 1
This is due to the version of Flutter you're using (stable channel, Flutter 2.0.3) is null-safety enabled. These are the APIs that were subject to change & so you need to use this migration guide to modify your code to use the new form of the APIs with null safety.
Method 1:
Check if you're using any of the aforementioned API dependencies & use .maybeOf(context) instead of .of(context, nullOk: true);
In your posted code,change your Localizations.localeOf(context, nullOk: true); to Localizations.maybeLocaleOf(context);
Method 2:
Find the dependency that caused the problem & update it to null safety, for example, if you're using flutter_svg: ^0.19.0 you'll encounter the same error, so either update it to flutter_svg: ^0.20.0-nullsafety.3 or in case you can't migrate to null safety yet, use this version flutter_svg: ^0.19.3
Method 3:
Alternatively, if you can also downgrade your Flutter version which doesn't provide null safety. It should also fix the error but needs the downgrading. To downgrade to v1.22.6 run the following command:
flutter downgrade v1.22.6
After each/any method, run the following commands:
flutter clean
flutter pub get
flutter run

Flutter New Project Build Error mergeDebugResources

I have created a new flutter project and out of nowhere it gives me the following errors when I run the default application (no edits made).
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-hi\values-hi.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-de\values-de.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lo\values-lo.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-pt\values-pt.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lt\values-lt.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-hr\values-hr.xml: AAPT: error: file failed to compile.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
C:\Users\bvenh\Documents\flutter\flutter_app_5\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-lv\values-lv.xml: AAPT: error: file failed to compile.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
Exception: Gradle task assembleDebug failed with exit code 1
I have tried everything!
I installed a new version of visual c++ as someone gave that as a solution to a question that was similar to mine on stack overflow.
I installed a new version of flutter
I installed a new version of Java JDK 1.8
I changed my user variables for JAVA_HOME & ANDROID_HOME
And it still does not work.
This is what flutter doctor outputs:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.22.2, on Microsoft Windows [Version 10.0.18362.1139], locale en-NL)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.50.1)
[√] Connected device (1 available)
• No issues found!
I use windows.
Old projects do work
So in short, what is the issue?
When I create a new project the default project (and all edits made after that) will result in a mergeDebugResources error, even without making any changes.
Does anyone know how to solve this?
Your help would be of major support!
It seems it is a Gradle issue. From this thread: https://github.com/flutter/flutter/issues/51690 There is this possible fix posted (updating Gradle version).
In gradle/wrapper/gradle-wrapper.properties try changing:
https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
to
https\://services.gradle.org/distributions/gradle-5.6.3-all.zip
There is also a stack overflow answer here:
https://stackoverflow.com/a/61156603/13714686
Which goes into detail about fixing this issue by changing Gradle settings.
I had same issue with my project and searched for an answer for hours. The solution was actually quite unexpected...
In Windows 10 "Security Options," I turned off the option of ransomware and tried to run the project and it worked. I don't know if this will solve the issue, but consider this as one option if same problem is encountered in future.

Flutter cannot get resource X86-64-debug

I am just new to Flutter and I am trying to create the web according to my colleague's code but I engage the error below:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
Could not download x86_64_debug.jar (io.flutter:x86_64_debug:1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32)
Could not get resource 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32/x86_64_debug-1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32.jar'.
Could not GET 'https://storage.googleapis.com/download.flutter.io/io/flutter/x86_64_debug/1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32/x86_64_debug-1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32.jar'.
Connect to storage.googleapis.com:443 [storage.googleapis.com/172.217.160.80] failed: Connection timed out: connect
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 1m 36s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
flutter version
Flutter 1.17.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f7a6a7906b (4 days ago) • 2020-05-12 18:39:00 -0700
Engine • revision 6bc433c6b6
Tools • Dart 2.8.2
enviroment variables
FLUTTER_STORAGE_BASE_URL is https://storage.flutter-io.cn,
PUB_HOSTED_URL is https://pub.flutter-io.cn
May I have your help for the issue, it looks like a connection problem but I can get the X86_Debug download in the brower while I can't determine where to place the file. Maybe the directory where the file placed could be helpful too.
Using a VPN worked for me. I am using protonVPN.

Flutter Project is not running when using indian domain

I created a project using following command on windows environment
flutter create --org in.myorg helloworld
Project is created successfully
Flutter version is as below
Flutter 1.9.1+hotfix.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1aedbb1835 (3 weeks ago) • 2019-10-17 08:37:27 -0700
Engine • revision b863200c37
Tools • Dart 2.5.0
When I run the code I get following error
e: D:\Project\test\helloworld\android\app\src\main\kotlin\in\myorg\helloworld\MainActivity.kt: (1, 9): Package name must be a '.'-separated identifier list
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 12s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 13.5s
Gradle task assembleDebug failed with exit code 1
.in domains are not allowed in flutter? using an incorrect domain will face issue while publishing app?
Yes, because in is one of Kotlin reserved keywords: keyword-reference
You can fix it by set Java as your Android platform language and not Kotlin.
Also, I think that this word is also reserved for Swift language.
I'm not sure if you can switch it on the fly but you can recreate your project with:
flutter create -i objc -a java command