flutterdart

Target of URI doesn't exist 'package:english_words/english_words.dart'


I'm learning to use Flutter using Android Studio. I'm going through step by step doc provided by Flutter. At Step:2 Use an external package I'm getting issue importing the english_words package. I have properly added the package in pubspec.yaml and clicked Packages Get which added the dependency but at the time of importing the package in lib/main.dart it is saying

Target of URI doesn't exist 'package:english_words/english_words.dart'.

I have seen many questions on StackOverflow but none of them helped me. Please help!


Solution

  • After adding the package in the pubspec.yaml file, you need to execute the command flutter packages get or click on "Packages Get" in the action ribbon at the top of pubspec.yaml file.

    Then the dependency and any transitive dependency will be added to the .packages file.

    Check this:

    https://flutter.io/using-packages/