dispose method

  1. @override
  2. @mustCallSuper
void dispose()

Disposes this node and cleans up resources.

This method marks the node as disposed, invokes onDispose for custom cleanup, and notifies the finalizer system so chained disposers can run.

Example:

final disposable = MyDisposableNode();
disposable.dispose(); // Cleanup happens automatically

Disposes this node and cleans up resources.

This method marks the node as disposed, invokes onDispose for custom cleanup, and notifies the finalizer system so chained disposers can run.

Example:

final disposable = MyDisposableNode();
disposable.dispose(); // Cleanup happens automatically

Implementation

@override
@mustCallSuper
void dispose() {
  if (_isDisposed) return;
  _isDisposed = true;
  // allow unawaited futures
  // ignore: discarded_futures
  onDispose();

  JFinalizer.disposeObject(this);
}