Honey Jaswal
Honey Jaswal

Reputation: 1

im unable to package get the package "english words" in pubspec.yaml

I'm unable to get the required package English_words. under dependencies I added English_words: ^3.1.5

screenshot of "pubspec.yaml" file with execution:

Edit: Issue resolved, importing package worked fine. The full code is also given in the flutter docs.

Upvotes: 0

Views: 1264

Answers (2)

taranjeetsapra
taranjeetsapra

Reputation: 572

I found error in pubspec.yaml file as shown in your screenshot. You need to add english_words: ^3.1.5 to dev_dependencies rather than in dependencies. Actual code snippet will be:

dev_dependencies:
  flutter_test:
    sdk: flutter
  english_words: ^3.1.5

Then click on Package get (shown in Android Studio) option to add above dependency for the project. You can also do the same using command(in project stucture):

flutter packages get

Upvotes: 0

Randal Schwartz
Randal Schwartz

Reputation: 44186

I suspect you are following the tutorial at https://flutter.io/docs/get-started/codelab#step-2-use-an-external-package ... the "+" in front of english_words there is an indicator of a diff. You should add that line, but leave off the +.

Upvotes: 1

Related Questions