dispose method

  1. @override
Future<void> dispose()
override

Disposes of the camera and releases associated resources.

This method unregisters the camera from the platform implementation and cleans up all resources. This instance should not be used after calling dispose.

Always call this method when you're done using the camera to prevent memory leaks.

Implementation

@override
Future<void> dispose() async {
  if (_initializeLock case final future?) await future;
  if (_id case final id?) {
    _instances.remove(id);
    await MulticameraPlatform.instance.unregisterCamera(id);
  }

  super.dispose();
}