)
Time-out the future computation after timeLimit
has passed.
Returns a new future that completes with the same value as this future, if this future completes in time.
If this future does not complete before timeLimit
has passed,
the onTimeout
action is executed instead, and its result (whether it
returns or throws) is used as the result of the returned future.
If onTimeout
is omitted, a timeout will cause the returned future to
complete with a TimeoutException.
Source
/**
* Time-out the future computation after [timeLimit] has passed.
*
* Returns a new future that completes with the same value as this future,
* if this future completes in time.
*
* If this future does not complete before `timeLimit` has passed,
* the [onTimeout] action is executed instead, and its result (whether it
* returns or throws) is used as the result of the returned future.
*
* If `onTimeout` is omitted, a timeout will cause the returned future to
* complete with a [TimeoutException].
*/
Future timeout(Duration timeLimit, {onTimeout()});