ZoneSpecification class Null safety
This class provides the specification for a forked zone.
When forking a new zone (see Zone.fork) one can override the default behavior of the zone by providing callbacks. These callbacks must be given in an instance of this class.
Handlers have the same signature as the same-named methods on Zone but receive three additional arguments:
- the zone the handlers are attached to (the "self" zone).
- a ZoneDelegate to the parent zone.
- the zone that first received the request (before the request was bubbled up).
Handlers can either stop propagation the request (by simply not calling the parent handler), or forward to the parent zone, potentially modifying the arguments on the way.
Constructors
-
ZoneSpecification({HandleUncaughtErrorHandler? handleUncaughtError, R run(Zone self, ZoneDelegate parent, Zone zone, R f()), R runUnary(Zone self, ZoneDelegate parent, Zone zone, R f(T arg), T arg), R runBinary(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2), ZoneCallback<
R> registerCallback(Zone self, ZoneDelegate parent, Zone zone, R f()), ZoneUnaryCallback<R, T> registerUnaryCallback(Zone self, ZoneDelegate parent, Zone zone, R f(T arg)), ZoneBinaryCallback<R, T1, T2> registerBinaryCallback(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2)), ErrorCallbackHandler? errorCallback, ScheduleMicrotaskHandler? scheduleMicrotask, CreateTimerHandler? createTimer, CreatePeriodicTimerHandler? createPeriodicTimer, PrintHandler? print, ForkHandler? fork}) -
Creates a specification with the provided handlers.
constfactory
-
ZoneSpecification.from(ZoneSpecification other, {HandleUncaughtErrorHandler? handleUncaughtError, R run(Zone self, ZoneDelegate parent, Zone zone, R f()), R runUnary(Zone self, ZoneDelegate parent, Zone zone, R f(T arg), T arg), R runBinary(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2), ZoneCallback<
R> registerCallback(Zone self, ZoneDelegate parent, Zone zone, R f()), ZoneUnaryCallback<R, T> registerUnaryCallback(Zone self, ZoneDelegate parent, Zone zone, R f(T arg)), ZoneBinaryCallback<R, T1, T2> registerBinaryCallback(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2)), ErrorCallbackHandler? errorCallback, ScheduleMicrotaskHandler? scheduleMicrotask, CreateTimerHandler? createTimer, CreatePeriodicTimerHandler? createPeriodicTimer, PrintHandler? print, ForkHandler? fork}) -
Creates a specification from
other
with the provided handlers overriding the ones inother
.factory
Properties
- createPeriodicTimer → CreatePeriodicTimerHandler?
-
read-only
- createTimer → CreateTimerHandler?
-
read-only
- errorCallback → ErrorCallbackHandler?
-
read-only
- fork → ForkHandler?
-
read-only
- handleUncaughtError → HandleUncaughtErrorHandler?
-
read-only
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- print → PrintHandler?
-
read-only
-
registerBinaryCallback
→ (ZoneBinaryCallback<
R, T1, T2> Function<R, T1, T2>?(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2))?) -
read-only
-
registerCallback
→ (ZoneCallback<
R> Function<R>?(Zone self, ZoneDelegate parent, Zone zone, R f())?) -
read-only
-
registerUnaryCallback
→ (ZoneUnaryCallback<
R, T> Function<R, T>?(Zone self, ZoneDelegate parent, Zone zone, R f(T arg))?) -
read-only
-
run
→ (R Function<
R>?(Zone self, ZoneDelegate parent, Zone zone, R f())?) -
read-only
-
runBinary
→ (R Function<
R, T1, T2>?(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2)?) -
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
-
runUnary
→ (R Function<
R, T>?(Zone self, ZoneDelegate parent, Zone zone, R f(T arg), T arg)?) -
read-only
- scheduleMicrotask → ScheduleMicrotaskHandler?
-
read-only
Methods
-
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 ==(
Object other) → bool -
The equality operator. [...]
inherited