Skip to content

Support Future<List<int>?> in matchesGoldenFile #132964

@iinozemtsev

Description

@iinozemtsev

Is there an existing issue for this?

Use case

Consider a code like this:

Future<Uint8List?> firstThumbnail(...)  async {
   ...
}

And a test like this:

 await expectLater(
        firstThumbnail(),
        matchesGoldenFile('expected'));

This test will pass in weak null safety mode, but will fail in sound null safety mode with an error:

  Assertion failed: "must provide a Finder, Image, Future<Image>, List<int>, or Future<List<int>>"
  package:flutter_test/src/_matchers_io.dart 98:7                                                                          MatchesGoldenFile.matchAsync
  package:matcher                                                                                                          expectLater
  package:flutter_test/src/widget_tester.dart 495:25                                                                       expectLater

Proposal

Check for item is Future<List<int>?> instead of item is Future<List<int>>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: tests"flutter test", flutter_test, or one of our testsc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions