dispose method

void dispose()

Dispose this SignalResult and release all listeners.

Disposes the results derived from this one (map / flatMap) as well; disposing a derived result on its own detaches it from this one. Idempotent.

Implementation

void dispose() {
  if (_disposed) return;
  _disposed = true;
  final children = _children.toList(growable: false);
  _children.clear();
  for (final child in children) {
    child._parent = null;
    child.dispose();
  }
  _parent?._children.remove(this);
  _parent = null;
  _signal.dispose();
}