ZoneDelegate class

An adapted view of the parent zone.

This class allows the implementation of a zone method to invoke methods on the parent zone while retaining knowledge of the originating zone.

Custom zones (created through Zone.fork or runZoned) can provide implementations of most methods of zones. This is similar to overriding methods on Zone, except that this mechanism doesn't require subclassing.

A custom zone function (provided through a ZoneSpecification) typically records or wraps its parameters and then delegates the operation to its parent zone using the provided ZoneDelegate.

While zones have access to their parent zone (through Zone.parent) it is recommended to call the methods on the provided parent delegate for two reasons:

  1. the delegate methods take an additional zone argument which is the zone the action has been initiated in.
  2. delegate calls are more efficient, since the implementation knows how to skip zones that would just delegate to their parents.

Constructors

ZoneDelegate()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

createPeriodicTimer(Zone zone, Duration period, void f(Timer timer)) Timer
createTimer(Zone zone, Duration duration, void f()) Timer
errorCallback(Zone zone, Object error, StackTrace stackTrace) AsyncError
fork(Zone zone, ZoneSpecification specification, Map zoneValues) Zone
handleUncaughtError(Zone zone, dynamic error, StackTrace stackTrace) → void
print(Zone zone, String line) → void
registerBinaryCallback<R, T1, T2>(Zone zone, R f(T1 arg1, T2 arg2)) ZoneBinaryCallback<R, T1, T2>
registerCallback<R>(Zone zone, R f()) ZoneCallback<R>
registerUnaryCallback<R, T>(Zone zone, R f(T arg)) ZoneUnaryCallback<R, T>
run<R>(Zone zone, R f()) → R
runBinary<R, T1, T2>(Zone zone, R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2) → R
runUnary<R, T>(Zone zone, R f(T arg), T arg) → R
scheduleMicrotask(Zone zone, void f()) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited