dispose method
Releases the resources of this camera.
Implementation
@override
Future<void> dispose() async {
if (_isDisposed) {
return;
}
_isDisposed = true;
// Update state so UI reflects streaming/recording stopped before native dispose
value = value.copyWith(
isStreamingVideoRtmp: false,
isRecordingVideo: false,
);
notifyListeners();
super.dispose();
if (_creatingCompleter != null) {
await _creatingCompleter!.future;
await _channel.invokeMethod<void>(
'dispose',
<String, dynamic>{},
);
await _eventSubscription?.cancel();
}
}