[英]Error on line 18, column 5 of pubspec.yaml: A dependency may only have one source
I'm doing a flutter bootcamp course.我正在参加 flutter 训练营课程。 The task was to add the english_words dependency but while implementing that I ran into an error in the dev_dependencies as it came from the code stub.任务是添加english_words 依赖项,但是在实现时我在dev_dependencies 中遇到了一个错误,因为它来自代码存根。
How can I fix this error?我该如何解决这个错误?
name: xylophone
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
# Use Audioplayers dependency version 0.17.4
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/
As for error message, there was an indentation issue.至于错误消息,存在缩进问题。 I think you didn't save the pubspec.yaml
file.我认为您没有保存pubspec.yaml
文件。 Copy and paste the full snippet and save it then run flutter pub get
or use the extension you've used复制并粘贴完整的代码片段并保存,然后运行flutter pub get
或使用您使用的扩展程序
name: xylophone
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
english_words: ^4.0.0
cupertino_icons: ^0.1.2
# Use Audioplayers dependency version 0.17.4
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/
You can use the pubspec.yaml given by @yeasin Sheikh.. Also if you unfamiliar with using pubspec.您可以使用@yeasin Sheikh 给出的 pubspec.yaml .. 另外,如果您不熟悉使用 pubspec。 The easiest way to add a package is to run添加 package 的最简单方法是运行
flutter pub add english_words
in terminal.在终端。 This will add the latest version of english_words package to your pubspec with proper indentation.这会将最新版本的 english_words package 添加到您的 pubspec 中,并带有适当的缩进。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.