abortTrigger property
Completion of this future aborts this request (if the client supports abortion).
Requests/responses may be aborted at any time during their lifecycle.
- If completed before the request has been finalized and sent,
Client.sendcompletes withRequestAbortedException. - If completed after the response headers are available, or whilst
streaming the response, clients inject
RequestAbortedExceptioninto theStreamedResponse.streamthen close the stream. - If completed after the response is fully complete, there is no effect.
A common pattern is aborting a request when another event occurs (such as a user action): use a Completer to implement this. To implement a timeout (to abort the request after a set time has elapsed), use Future.delayed.
This future must not complete with an error.
Some clients may not support abortion, or may not support this trigger.
Implementation
@override
final Future<void>? abortTrigger;