A Zone represents the asynchronous version of a dynamic extent. Asynchronous callbacks are executed in the zone they have been queued in. For example, the callback of a future.then is executed in the same zone as the one where the then was invoked.

Constants

Zone ROOT = _ROOT_ZONE
const

The root zone that is implicitly created.

Static Properties

current Zone
read-only

Properties

errorZone Zone
read-only

The error zone is the one that is responsible for dealing with uncaught errors. Errors are not allowed to cross between zones with different error-zones.

parent Zone
read-only

Returns the parent zone.

Operators

operator [](Object key) → dynamic

Retrieves the zone-value associated with key.

Methods

bindBinaryCallback(dynamic f(arg1, arg2), {bool runGuarded: true}) → ZoneBinaryCallback

Equivalent to:

bindCallback(dynamic f(), {bool runGuarded: true}) → ZoneCallback

Equivalent to:

bindUnaryCallback(dynamic f(arg), {bool runGuarded: true}) → ZoneUnaryCallback

Equivalent to:

createPeriodicTimer(Duration period, void callback(Timer timer)) → Timer

Creates a periodic Timer where the callback is executed in this zone.

createTimer(Duration duration, void callback()) → Timer

Creates a Timer where the callback is executed in this zone.

errorCallback(Object error, StackTrace stackTrace) → AsyncError

Intercepts errors when added programmtically to a Future or Stream.

fork({ZoneSpecification specification, Map zoneValues}) → Zone

Creates a new zone as a child of this.

handleUncaughtError(error, StackTrace stackTrace) → dynamic

inSameErrorZone(Zone otherZone) → bool

Returns true if this and otherZone are in the same error zone.

print(String line) → void

Prints the given line.

registerBinaryCallback(dynamic callback(arg1, arg2)) → ZoneBinaryCallback

Registers the given callback in this zone.

registerCallback(dynamic callback()) → ZoneCallback

Registers the given callback in this zone.

registerUnaryCallback(dynamic callback(arg)) → ZoneUnaryCallback

Registers the given callback in this zone.

run(dynamic f()) → dynamic

Executes the given function f in this zone.

runBinary(dynamic f(arg1, arg2), arg1, arg2) → dynamic

Executes the given callback f with argument arg1 and arg2 in this zone.

runBinaryGuarded(dynamic f(arg1, arg2), arg1, arg2) → dynamic

Executes the given callback f in this zone.

runGuarded(dynamic f()) → dynamic

Executes the given function f in this zone.

runUnary(dynamic f(arg), arg) → dynamic

Executes the given callback f with argument arg in this zone.

runUnaryGuarded(dynamic f(arg), arg) → dynamic

Executes the given callback f in this zone.

scheduleMicrotask(void f()) → void

Runs f asynchronously in this zone.