dispose method

Future<void> dispose()

Releases the native handle, the SurfaceTexture/CVPixelBuffer pool, and the per-instance render thread. Must be called from the consuming widget's dispose.

Implementation

Future<void> dispose() async {
  if (_disposed) return;
  _disposed = true;
  try {
    await _channel.invokeMethod<void>('dispose', {'textureId': textureId});
  } catch (_) {
    // Native side already released — swallow to keep widget dispose safe.
  }
}