suspend method
Releases the native session but keeps this controller usable; call initialize again to reopen. Used when the app goes to the background.
Implementation
Future<void> suspend() async {
final int? id = _sessionId;
if (id == null) return;
_recordingTicker?.cancel();
await _events?.cancel();
await _frames?.cancel();
_events = null;
_frames = null;
_sessionId = null;
try {
await UCameraChannel.invoke<void>("dispose", <String, Object?>{"sessionId": id});
} catch (_) {
// Ignored: suspension is best effort.
}
_emit(value.copyWith(state: UCameraState.uninitialized, clearTexture: true));
}