I moved my whole flutter project to a new folder, everything runs fine. The autocomplete works on the build in files from flutter, like Container, Column, but when I try using a package, like provider, I need to go on the pub.dev page and copy the import, import it manually, then I have to write "Provider.of(context)" manually. In the old project, I used to write Provider, press TAB, and everything would be auto imported and the VSCode would auto complete everything related to provider, not just bult in files. Whan should I do?
Flutter autocomplete not working in VSCode for packages
Asked Answered
You must make sure that your dependencies for plugins are mentioned under dependencies:
section, not under dev_dependencies:
section like following:
dependencies:
flutter:
sdk: flutter
cloud_firestore: ^0.13.7
firebase_auth: ^0.16.1
fluttertoast: ^7.0.2
I also had the same issue so I synced the dependencies again and put them under (dependencies:) it worked fine –
Modicum
Sometimes making this silly mistake is easy, may be due to time constraints or whatever but it is quite common and surprising thing is, plugin still works, just auto complete stops working. –
My
I was getting the same issue and fixed it by changing the flutter channel. The problem seems to be with the dart that ships with the flutter code.
If you are still facing this issue. Then try to change your channel
flutter channel ...
And then try
flutter upgrade
This will pull the dart version again and hopefully fix the import issue.
© 2022 - 2024 — McMap. All rights reserved.
cmd/ctlr + shift + P -> reload windows
as suggested here – Armlet