destroy method
Destroy the camera instance
Implementation
@override
Future<bool?> destroy() async {
try {
final Map<String, dynamic>? result =
await methodChannel.invokeMapMethod<String, dynamic>('destroy');
await events?.cancel();
if (result != null && result['error'] != null) {
throw result['error'];
}
final bool success = result?['success'] ?? false;
isDestroyed = success;
isRecording = false;
if (success) {
lastTextureId = null;
lastCameraSize = null;
}
return success;
} catch (e) {
return Future.error(e);
}
}