IsolatedObject<T> class
Wraps an object of type T in a dedicated isolate, allowing method calls
to be forwarded via evaluate.
This is useful for objects that perform work driven by timers or the event loop (e.g. progress spinners), ensuring their timers keep firing even when the calling isolate's event loop is blocked.
- Implementers
Constructors
-
IsolatedObject(Factory<
T> create, {bool keepIsolateAlive = true}) -
Spawns a dedicated isolate, constructs a
Tthere viacreate, and returns immediately. Subsequent evaluate calls forward work to that isolate.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether close has been called. Once true, further evaluate calls
throw a StateError.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Shuts down the isolate.
-
evaluate<
U> (FutureOr< U> function(T)) → Future<U> -
Evaluates
functionon the isolated object and returns the result. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited