ForkHandler typedef

ForkHandler = Zone Function(Zone self, ZoneDelegate parent, Zone zone, ZoneSpecification? specification, Map<Object?, Object?>? zoneValues)

The type of a custom Zone.fork implementation function.

Receives the Zone that the handler was registered on as self, a delegate forwarding to the handlers of self's parent zone as parent, and the current zone where the error was uncaught as zone, which will have self as a parent zone.

The handler should create a new zone with zone as its immediate parent zone.

The specification and zoneValues are the ones which were passed to Zone.fork of zone. They specify the custom zone handlers and zone variables that the new zone should have.

The custom handler can change the specification or zone values before calling parent.fork(zone, specification, zoneValues), but it has to call the parent's ZoneDelegate.fork in order to create a valid Zone object.

The function must only access zone-related functionality through self, parent or zone. It should not depend on the current zone (Zone.current).

Implementation

typedef ForkHandler = Zone Function(Zone self, ZoneDelegate parent, Zone zone,
    ZoneSpecification? specification, Map<Object?, Object?>? zoneValues);