runAsync<T> method
Null safety
- Future<
T> callback( - {@Deprecated('This parameter has no effect. ' 'This feature was deprecated after v2.6.0-1.0.pre.') Duration additionalTime = const Duration(milliseconds: 1000)}
Runs a callback
that performs real asynchronous work.
This is intended for callers who need to call asynchronous methods where the methods spawn isolates or OS threads and thus cannot be executed synchronously by calling pump.
The callback
must return a Future that completes to a value of type
T
.
If callback
completes successfully, this will return the future
returned by callback
.
If callback
completes with an error, the error will be caught by the
Flutter framework and made available via takeException, and this method
will return a future that completes with null
.
Re-entrant calls to this method are not allowed; callers of this method are required to wait for the returned future to complete before calling this method again. Attempts to do otherwise will result in a TestFailure error being thrown.
The additionalTime
argument was previously used with
AutomatedTestWidgetsFlutterBinding.addTime but now has no effect.
Implementation
Future<T?> runAsync<T>(
Future<T> Function() callback, {
@Deprecated(
'This parameter has no effect. '
'This feature was deprecated after v2.6.0-1.0.pre.'
)
Duration additionalTime = const Duration(milliseconds: 1000),
});