VSCode dart代码自动完成功能不适用于软件包 [英] VSCode dart code auto completion doesn't work properly for packages
问题描述
我使用VSCode进行Flutter开发,一切都很好,但是自动补全功能对于软件包来说无法正常工作.我想知道我的IDE设置有什么问题吗?如果我导入不带关键字的软件包,则代码补全功能将无法正常工作,但如果将它们导入为某种东西,则可以正常工作,例如,如果我按如下所示进行导入:
I use VSCode for flutter development everything is good but autocompletion is not working properly for packages.I wonder what is wrong with my IDE settings If I import packages without as keyword the code completion doesn't work but if I import them as something it works for example if I import like following :
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:http/http.dart'
智能感知无法识别FireStore和http,但是如果我像这样导入:
The intellisense doesn't recognize FireStore and http but if I import like:
import 'package:cloud_firestore/cloud_firestore.dart' as fire;
import 'package:http/http.dart' as http;
现在当我调用fire时,它会显示firestore类和方法,并且与http和其他所有包相同
now when I call fire It shows firestore class and methods and same is for http and every other package
推荐答案
由于您没有获得自动建议,请查看以下准则
Since you're not getting auto-suggestions, please check these guidelines
- 请确保您已将软件包包含在
pubspec.yaml
中 - 您是否执行了
flutter pub get
- 通常,我们可以使用 Ctrl + Space 来获取VSCode的自动建议
- Please ensure, you have included your package in
pubspec.yaml
- Did you executed
flutter pub get
- Usually, we can use Ctrl+Space to get auto-suggestion on VSCode
这篇关于VSCode dart代码自动完成功能不适用于软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!