简体   繁体   中英

Flutter doesn't recognize valid imports

This just started happening randomly. The app runs fine, but most valid imports are not recognized. This is happening with packages and local files.

I've restarted and Android Studio, did a pub cache repair, flutter clean, uninstalled and reinstalled the android studio flutter plugin, tried opening in VScode, nothing is helping.

Other people on my team have pulled my same repo and they are not experiencing this problem.

Any Ideas?

在此处输入图片说明

I faced to this problem and restarted Android Studio some times and it continue still not working. So, I changed the name of import and putted just the name of the file. Example: import 'authentication.dart' . Without the whole 'package:.../'.

If you're importing packages, try this in the terminal (same directory of the project):

with pub:

$ pub get

with flutter:

$ flutter pub get

大多数问题应该通过android studio“使缓存无效并重新启动”操作解决。

Its work for me

Bottom Menu -> Dart Analysis -> Restart Dart Analysis Server

OR try

flutter pub get

Until recognize valid imports

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM