action_take_picture method

Future<CameraTakePictureData?> action_take_picture({
  1. required void onCameraNotInit(),
  2. required void onCameraNotSelect(),
  3. required void onCameraNotActive(),
})

Implementation

Future<CameraTakePictureData?> action_take_picture({
  required void Function() onCameraNotInit,
  required void Function() onCameraNotSelect,
  required void Function() onCameraNotActive,
}) async {
  bool is_check_camera = util_check_camera(
    onCameraNotInit: onCameraNotInit,
    onCameraNotSelect: onCameraNotSelect,
    onCameraNotActive: onCameraNotActive,
  );
  if (!is_check_camera) {
    return null;
  }
  if (isMobile) {
    var res = (await camera_mobile_controller.takePicture());

    return CameraTakePictureData(
      mimeType: res.mimeType ?? "",
      path: res.path,
      name: res.name,
    );
  } else if (isDesktop) {
    if (Platform.isWindows) {
      var res = await camera_windows.takePicture(camera_id);
      return CameraTakePictureData(
        mimeType: res.mimeType ?? "",
        path: res.path,
        name: res.name,
      );
    }
  }
  return null;
}