I update the Flutter latest stable version 1.20.1 when I click the run button on an already existing project it shows me this error:
Could not resolve the package 'characters' in 'package: characters/characters.dart'.
But when I create a new project and try to run it works.
Following the Github issue below, it is a common issue after upgrading to a different Flutter Version
Could not resolve package characters
In my case, I resolved the issue with flutter clean.
Related
When I try to run my Flutter project, I get errors like:
../../../.pub-cache/hosted/pub.dev/file-6.1.2/lib/src/interface/file.dart:15:16: Error: The method 'File.create' has fewer named arguments than those of overridden method 'File.create'. Future create({bool recursive = false});
Running flutter clean and flutter upgrade didn't help. What's wrong? How do I fix this?
I kept getting the same error, But I solved it adding by adding
file: ^6.1.4 in my dependencies
If you are having the same problem. Make sure you have the latest file dependency.
I think the problem is caused by an outdated reference to file dependency. See this issue.
For fix this, on the project or library folder run:
dart pub upgrade
This command will upgrade your dependencies and the problem will be solved without adding the reference to latest version of file dependency.
I just ran in to this issue and I was on flutter's master channel. I switched back to stable (flutter channel stable) and everything works fine.
For me the packages in my pubspec.yaml were all up to date, but the following fixed it:
Delete pubspec.lock.
Run flutter pub get again.
i solved it by adding file: ^6.1.4 to my pubspec i dont know why this is needed in dependenccies but when i added it worked
this error occured to me when i was trying to update my flutter and packages
but error thrown was of transitive dependencies i guess when u defin in dependencies it over rides the transitive one
but it worked for me
but after wards once project ran i removed the file dependencie from my punspec did a flutter clean and a pub get again and ran the project again it worked without any problem
I got the code from Github, but the code version is an old version(Around version 2.2.3 to 2.8.1 ). I'm now on version 2.10.3. How do I migrate this code to a new version?
if you want to update this project to lastest mean to null safety then update the version in the dependencies in pubspec.yaml file
then run:
flutter clean
flutter pub get
flutter run
I will show you an easy way to migrate old code projects.
Firstly, I recommend not working on the current old project; it is so painful. Instead, create a new project where you can put your old project code into new code at a time.
Simply put a line of code below on the old code project terminal.
$ flutter create -t <project-type> <new-project-path>
For example, your terminal code like, PS C:\Users\habib\VScodeProject\git_ripository\simple-weather-old> flutter create -t app C:\Users\habib\VScodeProject\git_ripository\simple-weather-new
If you want to see more about flutter migrating: [See this flutter doc]
I wanted to run a background process in flutter.I used the code in https://pub.dev/packages/workmanager#-example-tab- and added the dependency required in pubspec.yaml file.
But I am getting "The built failed likely due to AndroidX incompatibilities in a plugin".The detail of the which I am sharing in the screenshot below(2 images):
I tried checking my gradle.properties file as suggested in some posts.But useAndroidX,enableJetifier were set "true".The details of gradle.properties is below:
android.useAndroidX=true
android.enableJetifier=true
This is my flutter doctor -v details:
The flutter build --verbose
I recently got this error, while using cloud_firestore plugin.
Since, Starting from Flutter v1.12.13, new projects created with flutter use AndroidX by default, therefore that didn't solve my problem.
After several times doing Pub get with any versions of plugin,
I figured all you have to do is:
• Go to android/app/build.gradle of your Flutter project, and
• Set minSdkVersion 21
Now, on running flutter build apk, the error should go away.
you just need to migrate to AndroidX maybe
https://flutter.dev/docs/development/androidx-migration
refer this link, please
I tried using the simple_permissions plugin and then I got an error to migrate to androidX even though I had migrated to androidX and after I deleted android.Jetifier at gradle.property I didn't get any more errors and the plugin was successfully used. Why did it happen? Will my project get a problem in the future? Thanks!
Make sure that all your packages in the pubspec.yaml are of the latest version. Then open the android project of your flutter app with android studio, select Refactor->Migrate to Androidx. Wait until android studio finishes migrating your project, rebuild your project. Hope it helps!
flutter app was working getting build and run on Xcode 10 on device iOS 12 fine before,
The time dart upgrade 2.1.0 happen in Flutter build iOS worked well with command and on Xcode 10 after build get success while running Flutter app on iPhone 7 iOS 12, it started giving error and app gets crash with following error message in Xcode logs.
Error is Runner[410:28754] [VERBOSE-3:dart_vm.cc(403)] Error while initializing the Dart VM: Wrong full snapshot version, expected '8343f188ada07642f47c56e518f1307c' found '46b2bfb57b5647c5f7527ff9aa56c69b'
Here are the details of the flutter sdk and dart .
Flutter 0.11.9 • channel beta • https://github.com/flutter/flutter.git
Framework • revision d48e6e4
Engine • revision 5c8147450d
Tools • Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
I have experienced this error and none of the above solution worked for me infact the option of clearing the flutter/bin/cache messed the entire vscode IDE.
So I deleted the entire flutter SDK and installed fresh new SDK from flutter official website.
After this installation everything was working fine.
I had this issue after a flutter upgrade. Uninstalling the app from the device and then flutter running it again solved the problem.
After deleting the flutter/bin/cache and running flutter clean, I couldn't get the dart sdk to load until I launched the flutter console (flutter_console.bat) that can be found in the directory where you installed flutter and ran flutter doctor there. That solved the problem.
Do git clean -xffd in flutter installed directory(repo).
If it's a Flutter project first try flutter clean if did not work, try above git command.
If still not solved, delete everything inside /flutter/bin/cache and try.
If still not :D,
Do flutter channel master, flutter upgrade, and flutter clean. If nothing worked please add a comment below.
If you are in Dart environment out flutter/bin/cach/dart-sdk, you may be not upgraded dart-sdk. This happen to me Dart 2.5.0 with chololate installed. So I just did choco upgrade dart-sdk
I have exactly this problem i Solve it how ?
by these comments you just update flutter
flutter channel beta
,
flutter upgrade
you should upgrade your dart sdk
So try this command :
choco install dart-sdk
if this is not work for you download it from this link
https://dart.dev/tools/sdk/archive;
and replace it with your current dart-sdk in flutter
I also have experienced the same issue. I upgraded the flutter version and later downgraded and encounter this issue maily on IOS adhoc build.
Solution:
Delete out $FLUTTER_HOME/bin/cache and run flutter doctor.
This will solve.
What worked for me was changing channel and upgrading and then changing channel back and upgrading.
I had to remove the flutter SDK folder in my computer completely and redownload the latest one at https://flutter.dev/docs/get-started/install/macos
Then, I ran flutter doctor.
You can find where your flutter folder is by typing which flutter in your terminal.
You don't need to uninstall the whole flutter and set environment path or anything else.
Just downgrade to any version by doing the below commands, suppose my current flutter version is v3.3.8 and I come across this issue then:
Go to flutter sdk-path in the command prompt and checkout to any branch you would like to switch for a moment, like v2.5.0. So,
By doing this you changed your repository from v3.3.8 to v2.5.0
git checkout v2.5.0
You can check previous flutter versions from here
link
Downgrade your flutter version to 2.5.0
flutter downgrade v2.5.0
Then upgrade flutter
flutter upgrade