expectLater function

Future<void> expectLater (dynamic actual, dynamic matcher, { String reason, dynamic skip })

Just like expect, but returns a Future that completes when the matcher has finished matching.

See test_package.expectLater for details.

If the matcher fails asynchronously, that failure is piped to the returned future where it can be handled by user code. If it is not handled by user code, the test will fail.

Implementation

Future<void> expectLater(
  dynamic actual,
  dynamic matcher, {
  String reason,
  dynamic skip, // true or a String
}) {
  // We can't wrap the delegate in a guard, or we'll hit async barriers in
  // [TestWidgetsFlutterBinding] while we're waiting for the matcher to complete
  TestAsyncUtils.guardSync();
  return test_package.expectLater(actual, matcher, reason: reason, skip: skip)
           .then<void>((dynamic value) => null);
}