dispose method

void dispose()
inherited

Releases all native resources held by this object.

After calling dispose:

  • isDisposed returns true
  • Any call to a method, property getter/setter, or stream getter throws a StateError with a descriptive message

Safe to call multiple times — subsequent calls are no-ops.

Override to release native handles, stop background timers, etc. Always call super.dispose().

Implementation

void dispose() {
  if (_disposed) return;
  _disposed = true;
  onDestroy();
}