How to solve Not found: 'dart:ui' error while running integration tests on Flutter
The integration tests can have no imports to your main App code or other flutter code that runs in the App - otherwise they will fail with your seen error.
Have a read of https://flutter.io/cookbook/testing/integration-test-introduction/ as this gives an example of integration tests with an app starting point that allows you to run setup code before your actual driver tests run if this is what you are looking to do. Otherwise don't use key values that use constants from your main code (as mentioned here http://cogitas.net/write-integration-test-flutter/).
Make sure that the import is set to this:
import 'package:test/test.dart';
instead of this:
import 'package:flutter_test/flutter_test.dart';
This is old post, but I found another possible reason why test gave me this error:
When I was creating new Bloc class I created constructor with @required
annotation and when I used Option+Enter for importing appropriate library, Android Studio imported 'package:flutter/cupertino.dart'
library instead of 'package:meta/meta.dart'
and that is the reason my unit test didn't start in the first place.
After importing correct library, all tests have passed!
Happy testing your code! :D