expectLater function

Future<void> expectLater(
  1. dynamic actual,
  2. dynamic matcher,
  3. {String? reason,
  4. dynamic skip}
)

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

See matcher_expect.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 matcher_expect.expectLater(actual, matcher, reason: reason, skip: skip)
           .then<void>((dynamic value) => null);
}