Pub get has not been run

To run the Pub package manager in Dart, you need to use the “pub get” command. This command retrieves and updates the dependencies defined in the pubspec.yaml file of your Dart project.

When you see the error message “pub get has not been run” it means that you have not yet fetched the required dependencies for your project. To resolve this issue, follow these steps:

  1. Open your command line or terminal.
  2. Navigate to the root directory of your Dart project (where the pubspec.yaml file is located).
  3. Run the command “pub get“.

Here is an example to illustrate the process:

    
    |- my_dart_project
       |- lib
          |- main.dart
       |- pubspec.yaml
    
  

Assuming you are in the root directory of “my_dart_project” on the command line, you would run:

    $ pub get
  

This command will fetch and update the necessary dependencies defined in your pubspec.yaml file. Once completed, you should be able to run your Dart project without seeing the “pub get has not been run” error message.

Read more interesting post

Leave a comment