Skip to content

RegisterCallbackHandler

typedef RegisterCallbackHandler = R Function() Function(
  Zone self,
  ZoneDelegate parent,
  Zone zone,
  R Function() f,
)

The type of a custom Zone.registerCallback implementation function.

A function used as ZoneSpecification.registerCallback to specialize the behavior of a new zone.

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 function f is the function which was passed to the Zone.registerCallback of zone.

The handler should return either the function f or another function replacing f, typically by wrapping f in a function which does something extra before and after invoking f

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