Alexandru Stroescu
Alexandru Stroescu

Reputation: 1167

Flutter autocomplete not working in VSCode for packages

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?

Upvotes: 5

Views: 5836

Answers (3)

Moustapha
Moustapha

Reputation: 128

Try to restart VS Code, worked for me.

Upvotes: 0

Nitesh
Nitesh

Reputation: 508

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.

Upvotes: 1

Muhammad Faizan
Muhammad Faizan

Reputation: 2088

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

Upvotes: 7

Related Questions