uninitialize static method

void uninitialize()

Resets the state of all pots and scopes to their initial state.

This removes all existing scopes and resets the scope index back to 0. It causes all pots to be reset. For any pot that holds an object, the disposer is called to allow for manual cleanup when the object is removed from the pot.

See also:

Implementation

static void uninitialize() {
  final count = ScopeState.currentScope;
  for (var i = count; i >= 0; i--) {
    ScopeState.scopes.clearScope(i, keepScope: false);
  }
  PotManager.allInstances.clear();
}