添加english_words依赖后pubspec.yaml报错,无法执行flutter pub get
解决pubspec.yaml添加english_words依赖报错的问题
问题原因
你把english_words: ^4.0.0错误缩进在了sdk: flutter的依赖块里,导致同一个依赖条目出现多个源,触发了"A dependency may only have one source"错误。
修复步骤
- 打开pubspec.yaml文件
- 调整
english_words的缩进层级,让它和flutter、cupertino_icons处于同一级别 - 保存文件后重新执行
flutter pub get
正确的依赖块示例
dependencies: flutter: sdk: flutter english_words: ^4.0.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2
内容的提问来源于stack exchange,提问作者Swati Buddha
相关产品推荐
相关产品推荐

