dispose method

void dispose()

Release all the resources associated with this ProviderContainer.

This will destroy the state of all providers associated with this ProviderContainer and call Ref.onDispose listeners.

Implementation

void dispose() {
  if (_disposed) return;

  _disposed = true;
  _parent?._children.remove(this);

  if (_root == null) scheduler.dispose();

  for (final element in getAllProviderElementsInOrder().toList().reversed) {
    element.dispose();
  }
}