ZoneCallback registerCallback(
dynamic callback()
)

Registers the given callback in this zone.

It is good practice to register asynchronous or delayed callbacks before invoking run. This gives the zone a chance to wrap the callback and to store information with the callback. For example, a zone may decide to store the stack trace (at the time of the registration) with the callback.

Returns a potentially new callback that should be used in place of the given callback.

Source

/**
 * Registers the given callback in this zone.
 *
 * It is good practice to register asynchronous or delayed callbacks before
 * invoking [run]. This gives the zone a chance to wrap the callback and
 * to store information with the callback. For example, a zone may decide
 * to store the stack trace (at the time of the registration) with the
 * callback.
 *
 * Returns a potentially new callback that should be used in place of the
 * given [callback].
 */
ZoneCallback registerCallback(callback());