AsyncTracker class Null safety

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 original zone, otherwise it is scheduled via a microtask.

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
isActive bool
Whether currently it has a running or scheduled code that will be executed in the current turn.
read-only
parentZone Zone
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
stream Stream
read-only
trackedZone Zone
read-only

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 non-existent 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