Flutter之导url_launcher包提示 A dependency may only have one source

491 阅读1分钟

1、问题

flutter 项目在 pubspec.yaml 导入 url_launcher 包,然后点击 Pub get 错误提示如下

F:\flutter_sdk\flutter\bin\flutter.bat --no-color pub get

Running "flutter pub get" in flutter_1...                       

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

26 │ │     url_launcher: ^5.5.0

29 │ │   # The following adds the Cupertino Icons font to your application.

30 │ │   # Use with the CupertinoIcons class for iOS style icons.

31 │ │   cupertino_icons: ^0.1.3

Process finished with exit code 65

2、分析

cupertino_icons 和 url_launcher 关键字没有左对齐

3、解决办法

让 cupertino_icons 和 url_launcher 关键字左对齐,然后再点击 Pub get 更新包就行