A dependency may only have one source

在使用Flutter的时候添加依赖报错了

Error on line 21, column 5 of pubspec.yaml: A dependency may only have one source.


21 │ ┌ sdk: flutter


22 │ │ http: '>=0.11.3+12'


23 │ │ webview_flutter: ^0.3.10+4

24 │ │
25 │ │ # The following adds the Cupertino Icons font to your application.
26 │ │ # Use with the CupertinoIcons class for iOS style icons.

27 │ │ cupertino_icons: ^0.1.2

│ └──^

pub get failed (65)

如图

 pubspec.yaml 文件添加依赖的内容,特别注意 sdk 对齐格式原因是格式不对,没有对齐 如图

修改格式对齐就好了,如图

然后点击 Packages get

OK

原文地址:https://www.cnblogs.com/changyiqiang/p/11906603.html