VSCode - Target of URI doesn't exist: 'package:english_words/english_words.dart' - flutter

I just got started with Flutter, following the google codelab for First Flutter Application.
I have tried all the previously answered solutions but none have worked for me.
Tried:
flutter packages get,
flutter packages upgrade,
flutter pub get,
flutter upgrade,
flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"
Flutter and Dart Plugins are installed in Android Studio as well.
Restarted multiple times too.
english_words-3.1.5 package is already present in .packages
Attaching Screenshot links for reference

Try running flutter clean from your Vs Code terminal.
Then restart.

Related

Failed to start DevTools: Dart DevTools exited with code 255

I am getting this error code in my Visual Studio Code. How can I fix it?
I am using Flutter v2.5.3.
You can try fixing it by running this in the terminal:
Just copy and paste the below code into the terminal and run it.
dart pub global activate devtools -v 2.8.0
which downgrades the version to 2.8.0 (that works fine). I found the answer on GitHub.
I agree with RandomCoder's answer to avoid executing command
dart pub global activate devtools -v 2.8.0
every time before opening Visual Studio Code.
And also if you didn't know the location of the build folder mentioned by RandomCoder, I found the location after reading it here for the pub cache folder:
By default, this directory is located under . pub-cache in your home directory (on macOS and Linux), or in %LOCALAPPDATA%\Pub\Cache (on Windows). (The precise location of the cache may vary depending on the Windows version.)
After you found it, go to the \hosted\pub.dartlang.org\devtools-2.8.0 directory to copy the build version there and paste it in \hosted\pub.dartlang.org\devtools-2.9.2.
I still didn't know if there is any bad effects of copy pasting it to a newer version folder, but in my case it's working until now.
In my case there wasn’t any build folder in the devtools-2.9.2 folder.
I copied it from 2.8.0 and it now works.
For Android Studio
Close Android Studio
Rn dart pub global activate devtools -v 2.8.0 to downgrade (as suggested in a previous answer)
Open Android Studio
Run your build
For Visual Studio Code
Open Terminal
Run dart pub global activate devtools -v 2.8.0 to downgrade (as suggested a previous answer)
I fix this by:
flutter upgrade
This is an issue coming since yesterday. Maybe they must have updated the Dart engine.
There are two ways which will help you to solve the issue.
Update the Flutter SDK to the latest version and restart your PC:
flutter upgrade
Use the Dart Devtools manually
Run flutter pub global in another terminal. Run devtools and then open http://127.0.0.1:9100
Enter a running application field address of your running application in the Connect: "http://127.0.0.1:60230/J7_wS_YhTuo=/"
You can find this URL in debug console when you run the code.
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:51849/mHlycLJYEWw=/ws
If you are getting any issue regarding the port, then do this in your Flutter project console
flutter run --observatory-port=9100
Once the application starts you can see the message in the console.
If you are getting any server issue in the web browser
then enter
dart devtools
In cmd
Downgrade to devtools-2.8.0
And activate using dart pub global activate devtools -v 2.8.0
These two steps worked in my case
First activate your devtool using this command...
flutter pub global activate devtools
flutter pub global run devtools
And after that, try launching it from Visual Studio Code as described in the documentation: Install and run DevTools from VS Code

Could not find an option named "devtools-server-address". when trying to run flutter app from AndroidStudio

I just updated Flutter plugin to 53.0.1, restarted Android Studio and hit "run" button and the error below show up:
Could not find an option named "devtools-server-address".
Close and reopen AndroidStudio resolved for me!
killall java
I downgraded from Flutter 2.0 to Flutter 1.22.5 and got this error.
To solve it,
Go to your terminal and write flutter channel stable.
Then run flutter doctor.
Now you may get another error like this -
If you have Flutter & Dart plugins already install, just ignore this error. This is a bug in Flutter 1.22.5 .
Just run the app and it will work fine!
I had the same issue but using VS Code on stable channel
Execute the following commands:
flutter channel stable
flutter upgrade
flutter clean
flutter pub get
Then, close and open your IDE
Follow the steps:
File -> Invalidate Cache and Restart. Run flutter clean Worked For me.
This so simple... Open terminal type flutter channel dev this solve your problem.
And after that flutter upgrade
Finally, flutter doctor
If it does not help:
Open terminal type flutter channel stable
And after that flutter upgrade
Finally, flutter doctor
Working without upgrading flutter
Safe fix for Mac (Android Studio 4.1+). It is in a different directory now, but the symbolic link helps.
Just run this command in the Terminal:
ln -s ~/Library/Application\ Support/Google/AndroidStudio4.1/plugins ~/Library/Application\ Support/AndroidStudio4.1
Change the version of the Android studio depending on what you have, I had 4.2 so used.
ln -s ~/Library/Application\ Support/Google/AndroidStudio4.2/plugins ~/Library/Application\ Support/AndroidStudio4.2
Just Invalidate Cache and Restart. Worked for me.
Just close your all project and also close Android Studio and Reopen.

ERROR with flutter: CocoaPods not installed even if it is installed

I am trying to run my code on AndroidStudio by using Flutter but when I run it shows an error:
Warning: CocoaPods not installed. Skipping pod install. CocoaPods is
used to retrieve the iOS and macOS platform side's plugin code that
responds to your plugin usage on the Dart side. Without CocoaPods,
plugins will not work on iOS or macOS. For more info, see
https://flutter.dev/platform-plugins To install see
https://guides.cocoapods.org/using/getting-started.html#installation
for instructions.
CocoaPods not installed or not in valid state. Error launching
application on iPhone 11.
flutter doctor shows that all is fine, I looked around a lot and tried lots of things like uninstall it and install it again, and tried adding:
dev_dependencies:
build_runner: ^1.10.0
dependency_overrides:
analyzer: 0.39.14
and tried
flutter channel stable
flutter upgrade
and tried
flutter channel master
flutter upgrade
But nothing worked, note that when I write "which pod" it shows the path, that means it exists right? then what is the problem? please help :(
have you tried to run pod install from the ios folder?
The only thing that worked with me is using android emulator, ios simulator still show the same error
I had the same issue and I found a solution, but with still an answered question. See my question (and one partial solution) here
The partial solution is: in Android Studio, click on the tab "Terminal" at the bottom of the IDE and in this pane, type flutter run. It does the same as the button Run, and Android Studio stopped complaining about CocaPods.
To stop the app, type q in the same terminal.

flutter pub outdated for a specific package?

When I run
flutter pub outdated
it gives me a list of all the packages I have in pubspec.yaml which are outdated. What if I have more than 100 packages in it, I'd like to know is there any command or way (except searching in terminal) to find out the information provided by above command but only for that package, something like:
flutter pub outdated xyz
where xyz is my package.
For Android Studio and IntelliJ, use Flutter pub version checker
For Visual Studio Code, use Pubspec assist
There is this plugin for Android Studio called Flutter enhancement suite which automatically detects outdated packages and suggests updates for you inside pubspec.yaml file

Flutter app Error while initializing the Dart VM: Wrong full snapshot version, expected '8343.....' found '46b2....'

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