PrintHandler typedef Null safety

void PrintHandler(
  1. Zone self,
  2. ZoneDelegate parent,
  3. Zone zone,
  4. String line
)

The type of a custom Zone.print 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 string line is the one which was passed to Zone.print of zone, (possibly through the global print function).

The custom handler can intercept print operations and redirect them to other targets than the console.

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 void PrintHandler(
    Zone self, ZoneDelegate parent, Zone zone, String line);