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

hashCodeint
read-only, inherited
The hash code for this object. [...]
runtimeTypeType
read-only, inherited
A representation of the runtime type of the object.

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, Object error, StackTrace stackTrace) → void
noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed. [...]
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
toString() → String
inherited
A string representation of this object. [...]

Operators

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

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-async/ZoneDelegate-class.html