SafeCompleter<T extends Object> class

A wrapper around Dart's Completer that prevents it from being completed more than once.

It provides an API for resolving a value and safely accessing the result via a Resolvable. This is useful for managing one-off asynchronous operations where multiple callers might attempt to set the result.

Constructors

SafeCompleter()

Properties

hashCode → int
The hash code for this object.
no setterinherited
isCompleted → bool
Indicates whether the completer has been fulfilled with a value or error.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

complete(FutureOr<T> value) → Resolvable<T>
A convenience method to complete with a direct value or future.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolvable() → Resolvable<T>
Returns a Resolvable that provides access to the completer's result.
resolve(Resolvable<T> resolvable) → Resolvable<T>
Safely resolves the completer with the outcome of a Resolvable.
toString() → String
A string representation of this object.
inherited
transf<R extends Object>([R noFutures(T e)?]) → SafeCompleter<R>
Creates a new SafeCompleter by transforming the future value of this one.

Operators

operator ==(Object other) → bool
The equality operator.
inherited