dispose method
Releases the device and everything else this session holds.
Mid-recording, the device is aborted and the partial file deleted: the page that started it is gone and nothing will ever pick the file up. A recording that already finished keeps its file.
Implementation
Future<void> dispose() async {
if (_disposed) return;
final bool open = !_terminal;
_disposed = true;
final DVCaptureBackend? backend = _backend;
if (open && backend != null) await backend.abort();
await _release();
_capturing.set(false);
if (open) {
await _discardPath();
if (!_completer.isCompleted) {
_completer.completeError(
const DVCaptureInterrupted(DVCaptureInterruption.disposed, null));
}
}
_state.set(DVCaptureState.disposed);
await _state.close();
await _capturing.close();
}