AsyncTracker class
Tracks async callbacks (e.g. microtask, Future, Stream, Timer) and indicates when any of these has completed their executions. It can be used to track and react on async event chains.
Clients of the AsyncTracker either listen on the stream or they can add or remove listeners that receive these events.
Constructors
- AsyncTracker({Zone? zone, Duration? duration})
-
When
duration
is specified, the tracking event is schedule via a Timer in the originalzone
, otherwise it is scheduled via a microtask.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isActive → bool
-
Whether currently it has a running or scheduled code that will be executed
in the current turn.
no setter
- parentZone → Zone
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stream → Stream
-
no setter
- trackedZone → Zone
-
no setter
Methods
-
addListener(
Function callback) → void - Add event listener that will get called when the tracker emits an event.
-
close(
) → Future - Closes the tracker and doesn't accept new listeners.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeListener(
Function callback) → void - Remove previously added event listener.
-
run<
R> (R fn()) → R -
Runs
fn
in the tracked zone. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited