VSCode dart代码自动完成不适用于软件包 [英] VSCode dart code auto completion doesn't work properly for packages

查看:216
本文介绍了VSCode dart代码自动完成不适用于软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VSCode进行颤振开发,一切都很好,但是自动完成功能对于软件包不起作用。我想知道我的IDE设置有什么问题
如果我导入没有as关键字的软件包,代码完成不起作用,但是如果我将它们导入为它可以正常工作的东西,例如,如果我按如下所示进行导入:

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'

intellisense无法识别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屋!

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