runAsyncWithConsoleCapture<T> method

Future<T?> runAsyncWithConsoleCapture<T>(
  1. WidgetTester tester,
  2. Future<T> callback()
)

Runs asynchronous app work in a capture zone even when the test binding moves execution out of the calling zone.

Implementation

Future<T?> runAsyncWithConsoleCapture<T>(
  WidgetTester tester,
  Future<T> Function() callback,
) =>
    LiveAsyncCallSupport.runUntracked<T>(
      () => runZoned<Future<T>>(
        callback,
        zoneSpecification: consoleCaptureZone,
      ),
      // Setup and plugin work shares the same non-reentrant lane as app
      // APIs. Calling tester.runAsync directly here can overlap a request
      // that was started by the preceding screen/test attempt.
      runnerOverride: tester.runAsync,
    );