I am facing this problem for a while now. When i add a library or package in a flutter project and then run
flutter pub get
But when i import that package, it is not available (as if it is not included in pubspec)
As long as i Know, running the command
flutter pub get
actually downloads that package but for some reason is not availale to be used in the project files. I have to restart the android studio every time to use the new library
I tried the following but they did not help.
- Open andriod studio in administrator mode
- Delete the pubspec.lock file
- Upgraded the flutter to latest version
- Upgraded the android studio to latest version
- Open pubspec.yaml and then press
Get Dependencies - Add the package using Terminal for example
flutter pub add library_name
All these do not help and I must have to restart the android studio. Then everything works.
Additional Info I wonder if it has to do something with my project structure or something. Because i craeted a new flutter project and there is no such problem.