BloomRpcCancelToken class
Cancellation token used to abort in-flight RPC requests.
Pass an instance of BloomRpcCancelToken to BloomRpcClient.call. Calling cancel immediately rejects pending request futures with a BloomRpcCancelledException.
final token = BloomRpcCancelToken();
// Start request
final future = client.call(fetchFeedContract, null, cancelToken: token);
// Cancel when user navigates away
token.cancel('User navigated away');
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCancelled → bool
-
Whether cancellation has been requested.
no setter
-
onCancelled
→ Future<
void> -
Future that completes when cancel is called.
no setter
- reason → String?
-
The cancellation reason, or
nullif none was supplied.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancel(
[String? reason]) → void - Requests cancellation of any active requests bound to this token.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
throwIfCancelled(
[BloomRpcContract? contract, Uri? uri]) → void - Throws a BloomRpcCancelledException if cancellation has already occurred.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited