registerCallback abstract method

ZoneCallback<R> registerCallback<R>(R callback())

Registers the given callback in this zone.

When implementing an asynchronous primitive that uses callbacks, the callback must be registered using registerCallback at the point where the user provides the callback. This allows zones to record other information that they need at the same time, perhaps even wrapping the callback, so that the callback is prepared when it is later run in the same zones (using run). For example, a zone may decide to store the stack trace (at the time of the registration) with the callback.

Returns the callback that should be used in place of the provided callback. Frequently zones simply return the original callback.

Custom zones may intercept this operation. The default implementation in Zone.ROOT returns the original callback unchanged.

Source

ZoneCallback<R> registerCallback<R>(R callback());

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-async/Zone/registerCallback.html