getCallbackFromHandle method Null safety

Function? getCallbackFromHandle(
  1. CallbackHandle handle
)

Get a tear-off of a named top-level or static callback represented by a handle.

The handle argument must not be null.

If handle is not a valid handle returned by PluginUtilities.getCallbackHandle, null is returned. Otherwise, a tear-off of the callback associated with handle is returned.

Implementation

static Function? getCallbackFromHandle(CallbackHandle handle) {
  assert(handle != null, "'handle' must not be null.");
  return _backwardCache.putIfAbsent(
      handle, () => _getCallbackFromHandle(handle.toRawHandle()));
}