11

Whenever I add new tests to my codebase I encounter the aforementioned error message while running them.

package:flutter_tools/src/test/flutter_tester_device.dart 224:73  FlutterTesterTestDevice.finished
===== asynchronous gap ===========================
dart:async/future.dart                                            Future.any.onValue
Failed to load "app/test/club/club_section_test.dart": Shell subprocess ended cleanly. Did main() call exit()?

1 Answer 1

14

TLDR

flutter clean && flutter packages get

Workaround

Well it seems that for some reason flutter is caching some data that becomes stale, you can easily get the test back by running:

flutter clean 

Which "Delete the build/ and .dart_tool/ directories" and then:

flutter packages get

To rebuild those directories and download dependencies.

2
  • Yes this temporarily solves the problem but it keeps happening over and over again, wheras it didn't used to happen. Having to flutter clean and refetch packages every time I want to run my tests isn't practical. There must be some underlying problem that is causing this to happen in the first place that isn't being solved. Nov 10, 2021 at 3:06
  • Agree @ActionJackBarker , this was just a workaround I found and wanted to share. Don't know if this is already being looked into in the flutter repo.
    – croxx5f
    Nov 10, 2021 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.