Flutter autocomplete not working in VSCode for packages
Asked Answered
A

3

5

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?

Apostatize answered 4/2, 2020 at 14:10 Comment(3)
can you try cmd/ctlr + shift + P -> reload windows as suggested hereArmlet
It actually stopped the whole auto complete feature, now it doesn't complete anything. What can I do??Apostatize
i'm having the issue. reloading doesn't help.Marthamarthe
M
7

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
My answered 6/8, 2020 at 13:47 Comment(2)
I also had the same issue so I synced the dependencies again and put them under (dependencies:) it worked fineModicum
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
S
1

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.

Stope answered 14/4, 2021 at 12:59 Comment(0)
A
0

Try to restart VS Code, worked for me.

Alvy answered 6/9, 2022 at 3:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.