ZoneSpecification class

A parameter object with custom zone function handlers for Zone.fork.

A zone specification is a parameter object passed to Zone.fork and any underlying ForkHandler custom implementations. The individual handlers, if set to a non-null value, will be the implementation of the correpsonding Zone methods for a forked zone created using this zone specification.

Handlers have the same signature as the same-named methods on Zone, but receive three additional arguments:

  1. The zone the handlers are attached to (the "self" zone). This is the zone created by Zone.fork where the handler is passed as part of the zone delegation.
  2. A ZoneDelegate to the parent zone.
  3. The "current" zone at the time the request was made. The self zone is always a parent zone of the current zone.

Handlers can either stop propagating 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})
const
factory
Creates a specification with the provided handlers. [...]
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})
factory
Creates a specification from other and provided handlers. [...]

Properties

createPeriodicTimerCreatePeriodicTimerHandler?
read-only
A custom Zone.createPeriodicTimer implementation for a new zone.
createTimerCreateTimerHandler?
read-only
A custom Zone.createTimer implementation for a new zone.
errorCallbackErrorCallbackHandler?
read-only
A custom Zone.errorCallback implementation for a new zone.
forkForkHandler?
read-only
A custom Zone.handleUncaughtError implementation for a new zone.
handleUncaughtErrorHandleUncaughtErrorHandler?
read-only
A custom Zone.handleUncaughtError implementation for a new zone.
hashCodeint
read-only, inherited
The hash code for this object. [...]
printPrintHandler?
read-only
A custom Zone.print implementation for a new zone.
registerBinaryCallback → (ZoneBinaryCallback<R, T1, T2> Function<R, T1, T2>?(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2))?)
read-only
A custom Zone.registerBinaryCallback implementation for a new zone.
registerCallback → (ZoneCallback<R> Function<R>?(Zone self, ZoneDelegate parent, Zone zone, R f())?)
read-only
A custom Zone.registerCallback implementation for a new zone.
registerUnaryCallback → (ZoneUnaryCallback<R, T> Function<R, T>?(Zone self, ZoneDelegate parent, Zone zone, R f(T arg))?)
read-only
A custom Zone.registerUnaryCallback implementation for a new zone.
run → (R Function<R>?(Zone self, ZoneDelegate parent, Zone zone, R f())?)
read-only
A custom Zone.run implementation for a new zone.
runBinary → (R Function<R, T1, T2>?(Zone self, ZoneDelegate parent, Zone zone, R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2)?)
read-only
A custom Zone.runBinary implementation for a new zone.
runtimeTypeType
read-only, inherited
A representation of the runtime type of the object.
runUnary → (R Function<R, T>?(Zone self, ZoneDelegate parent, Zone zone, R f(T arg), T arg)?)
read-only
A custom Zone.runUnary implementation for a new zone.
scheduleMicrotaskScheduleMicrotaskHandler?
read-only
A custom Zone.scheduleMicrotask implementation for a new zone.

Methods

noSuchMethod(Invocation invocation) → dynamic
inherited
Invoked when a non-existent method or property is accessed. [...]
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/ZoneSpecification-class.html