Flutter自动完成功能在VSCode中不起作用 [英] Flutter autocomplete not working in VSCode for packages

查看:87
本文介绍了Flutter自动完成功能在VSCode中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将整个flutter项目移到了一个新文件夹中,一切运行正常.自动完成功能可用于处理来自Flutter的内置文件,例如Container,Column,但是当我尝试使用包(例如provider)时,我需要进入pub.dev页面并复制导入,手动将其导入,然后我必须手动编写"Provider.of(context)".在旧项目中,我曾经编写Provider,然后按TAB键,所有内容都会自动导入,而VSCode会自动完成与provider相关的所有内容,而不仅仅是文件中的内容.我该怎么办?

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?

推荐答案

您必须确保在 dependencies:部分(而不是在 dev_dependencies:下)中提到对插件的依赖关系>部分,如下所示:

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

这篇关于Flutter自动完成功能在VSCode中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆