【问题标题】:Why can't I add packages to flutter为什么我不能在颤振中添加包
【发布时间】:2020-10-17 20:22:47
【问题描述】:

我尝试添加依赖项: english_words: ^3.1.5 在我的 pupsec.yaml 文件中,当我尝试使用 Flutter Pub Get 命令时出现此错误: Mathiass-MacBook-Pro:startuplabs_0 mathiassoderlund$ flutter pub get pubspec.yaml 第 34 行第 5 列的错误:依赖项可能只有一个源。 ╷
34 │ ┌ sdk: 颤振
35 │ │
36 │ 依赖关系:
37││颤动:
38 │ │ sdk:颤振
39 │ │
40 │ │
41 │ │ 英文单词:^3.1.5
42 │ │
43 │ │ # 有关此文件的通用 Dart 部分的信息,请参阅 44 │ │ # 后续页面:https://dart.dev/tools/pub/pubspec
45 │ │
46 │ └ # 以下部分是 Flutter 特有的。

Running "flutter pub get" in startuplabs_0...                           
pub get failed (65;    ╵)
Mathiass-MacBook-Pro:startuplabs_0 mathiassoderlund$ 

这是我的 pupspec.yaml 文件:Pupspec.yaml

【问题讨论】:

标签: android-studio flutter


【解决方案1】:

你写错地方了,写在cupertino_icons下面

dependencies:
  flutter:
    sdk: flutter

    cupertino_icons: ^0.1.2
    english_words: ^3.1.5

【讨论】:

  • Cupertino 也是依赖,为什么你说错了?
【解决方案2】:

在 english_words 前使用适当的缩进(空格)。

代码应该是这样的-

dependencies:
  flutter:
    sdk: flutter

  english_words: ^3.1.5

希望这会对你有所帮助。

【讨论】:

  • 是的,但现在我收到此错误:请更正 /Users/mathiassoderlund/AndroidStudioProjects/startuplabs_0/pubspec.yaml 中的 pubspec.yaml 文件
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-12-22
  • 1970-01-01
  • 2021-03-13
  • 1970-01-01
  • 2021-01-07
  • 2021-11-06
  • 1970-01-01
相关资源
最近更新 更多