activateCamera method
Future<void>
activateCamera({
- required void setState(
- void callback()
- required bool mounted(),
Implementation
Future<void> activateCamera({
required void Function(void Function() callback) setState,
required bool Function() mounted,
}) async {
if (!is_camera_init) {
return;
}
if (!is_select_camera) {
return;
}
if (isMobile) {
try {
await camera_mobile_controller.initialize();
if (!mounted.call()) {
return;
}
is_camera_active = true;
setState(() {});
} catch (e) {
if (kDebugMode) {
print(e);
}
}
} else if (isDesktop) {
if (Platform.isWindows) {
await camera_windows.initializeCamera(camera_id);
is_camera_active = true;
setState(() {});
}
}
}