Skip to content

[flutter_test] flutter_test_config testMain impossible in Dart 2.12.0 #70861

@creativecreatorormaybenot

Description

This is a very simple issue:

/// Before a test file is executed, the Flutter test framework will scan up the
/// directory hierarchy, starting from the directory in which the test file
/// resides, looking for a file named `flutter_test_config.dart`. If it finds
/// such a configuration file, the file will be assumed to have a `main` method
/// with the following signature:
///
/// ```dart
/// Future<void> main(FutureOr<void> testMain());
/// ```

This is what the flutter_test documentation says.

When I try to write the following code using Dart 2.12.0 (build 2.12.0-29.10.beta):

Future<void> main(FutureOr<void> Function() testMain) async {
  await testMain();
}

I receive the following error:

The type of the first positional parameter of the 'main' function must be a supertype of List.

It seems like what flutter_test used for configuration is now impossible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testsd: api docsIssues with https://api.flutter.dev/

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions