flutter run failed with error "Could not resolve the package 'characters' in 'package:characters/characters.dart'."

Viewed 4813

Flutter run command

Output Could not resolve the package 'characters' in 'package:characters/characters.dart'.

flutter doctor

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.47.2)
[✓] Connected device (3 available)
7 Answers

It could just be an issue with flutter's cache.

Run flutter clean to clear your cache.

I faced with this Error today (when i updated to Flutter 1.20.0-7.2.pre • channel beta) and finaly i solved it with deleting the .dart_tool (location: ../yourProject/.dart_tool) folder in my project and run my project again.

I don't want to repeat the same solution as it is already been given: Yes, 'flutter clean' does the job cleaning the unused files from the previous version. I though have a habit to run this command periodically and upon each upgrade to keep clearing the cache. And for the past 2 years, I am not facing such issues.

Run these commands and hopefully your problem will be solved:

flutter pub cache repair

or

flutter clean

then try to run it with

flutter run

command

Related