dispose method

  1. @override
Future<void> dispose()

Release all resources held by device and detach all outputs.

No other methods can be called after a controller is disposed.

Implementation

@override
Future<void> dispose() async {
  if (disposed) return Future<void>.value();
  stop();
  super.dispose();

  await Future.wait(
    outputs.map<Future<void>>((CameraOutput output) => output.detach(this)),
    eagerError: true,
  );
}