Unable to run unit tests when pubspec uses Path packages on Dart 2.7 or greater

I have a dart only project that I am running in IntelliJ. IntelliJ is using the version of dart made for Flutter.

Using v1.12.13 (current dev or v1.13.1-pre.89, master), when I run a test I get the following error message

The “.dart_tool/package_config.json” file is not recognized by “pub” version, please run “pub get”.

I run pub get, or flutter pub get again but I get the same error when I try to run the file again in IntelliJ.

I’m really stumped so if anyone could help that would be great.


To recreate the problem use Flutter v1.12.13 (uses Dart 2.7)
Open / create a local Dart only project
Reference a local package using the path: syntax in the pubspec.yaml file
Right click in IntelliJ on a test in the first project and select run

Author: Fantashit

1 thought on “Unable to run unit tests when pubspec uses Path packages on Dart 2.7 or greater

  1. After we’ve added package as path we having this issue too.

    Flutter is already up to date on channel stable
    Flutter 1.22.4 • channel stable • git@github.com:flutter/flutter.git
    Framework • revision 1aafb3a8b9 (4 weeks ago) • 2020-11-13 09:59:28 -0800
    Engine • revision 2c956a31c0
    Tools • Dart 2.10.4
    • multiple flutter pub get does not work.
    • flutter clean + removing pubspec.lock and .packages does not work

    What does help is using dart pub instead of flutter pub.

    dart pub get
    dart pub run ...

    The interesting thing is we have multiple steps in our CI where we want to ensure packages are fetched and we have to switch all steps to dart pub.

    dart pub get
    dart pub run ...
    # does not work
    flutter pub get
    flutter pub run ...

Comments are closed.