fork method Null safety

Zone fork (
  1. {ZoneSpecification? specification,
  2. Map<Object?, Object?>? zoneValues}
)

Creates a new zone as a child of this.

The new zone uses the closures in the given specification to override the current's zone behavior. All specification entries that are null inherit the behavior from the parent zone (this).

The new zone inherits the stored values (accessed through operator []) of this zone and updates them with values from zoneValues, which either adds new values or overrides existing ones.

Note that the fork operation is interceptible. A zone can thus change the zone specification (or zone values), giving the forking zone full control over the child zone.

Implementation

Zone fork(
    {ZoneSpecification? specification, Map<Object?, Object?>? zoneValues});