registerScopeExitCallback function

void registerScopeExitCallback(
  1. ScopeExitCallback onScopeExitCallback
)

Register a onScopeExitCallback to be invoked when this service scope ends.

The registered on-scope-exit functions are executed in reverse registration order.

Implementation

void registerScopeExitCallback(ScopeExitCallback onScopeExitCallback) {
  var serviceScope = _serviceScope;
  if (serviceScope == null) {
    throw StateError('Not running inside a service scope zone.');
  }
  serviceScope.registerOnScopeExitCallback(onScopeExitCallback);
}