addDispose method

void addDispose(
  1. Dispose dispose
)

Adds this dispose to this DisposeScope's internal list of Disposes.

dispose will be called when this DisposeScope is disposed.

Implementation

void addDispose(Dispose dispose) {
  if (_disposed) {
    throw StateError('This dispose scope is already disposed');
  }

  _disposes.add(dispose);
}