Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am getting red lines under my flutter code but the code is perfectly functioning and there is no error

As you can see on the top right side, there is a green tick meaning the code is working and the app I built using this functioning perfectly and as expected. Need help getting ride of those red underlines.

https://i.sstatic.net/jJvvJ.png

Update 1:Output of flutter doctor -v Update 2:Output of debug on app

like image 903
Gautam Mundada Avatar asked Oct 25 '25 02:10

Gautam Mundada


2 Answers

I had the same issue, it was very frustrating but was able to solve it.

What worked for me was restoring my Android Studio setting to the default settings by removing the entire ".AndroidStudio4.0" (or whatever version you are using) folder that is usually located in C:\Users\[user name]\.

Then you open Android Studio, select NOT to import any settings, install the Dart and Flutter plugins, and that's it.

It should take about 2 minutes.

like image 123
Noboru82 Avatar answered Oct 26 '25 18:10

Noboru82


Welcome to stack overflow. Looks like a standard package import error.

See link here. https://flutter.dev/docs/development/packages-and-plugins/using-packages

I suggest you try in terminal running three commands

flutter doctor
flutter clean 
flutter pub get

If you see errors at any of these commands, act accordingly.

If no error, I suggest check the contents of your .packages file and pubspec.lock that they list all the dependencies you want to import including Flutter and Dart.

like image 27
Alexandre Jean Avatar answered Oct 26 '25 18:10

Alexandre Jean