CameraConfiguration.fromJson constructor

CameraConfiguration.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory CameraConfiguration.fromJson(Map<String, dynamic> json) =>
    CameraConfiguration(
      cameraModule: json.containsKey("cameraModule")
          ? CameraModule.values.byName(json["cameraModule"] as String)
          : CameraModule.BACK,
      zoomSteps: json.containsKey("zoomSteps")
          ? (json["zoomSteps"] as List<dynamic>)
              .map((it) => (it as num).toDouble())
              .toList()
          : [1.0, 2.0, 5.0],
      defaultZoomFactor: json.containsKey("defaultZoomFactor")
          ? (json["defaultZoomFactor"] as num).toDouble()
          : 1.0,
      flashEnabled: json.containsKey("flashEnabled")
          ? (json["flashEnabled"] as bool)
          : false,
      minFocusDistanceLock: json.containsKey("minFocusDistanceLock")
          ? (json["minFocusDistanceLock"] as bool)
          : false,
      touchToFocusEnabled: json.containsKey("touchToFocusEnabled")
          ? (json["touchToFocusEnabled"] as bool)
          : false,
      pinchToZoomEnabled: json.containsKey("pinchToZoomEnabled")
          ? (json["pinchToZoomEnabled"] as bool)
          : true,
      orientationLockMode: json.containsKey("orientationLockMode")
          ? OrientationLockMode.values
              .byName(json["orientationLockMode"] as String)
          : OrientationLockMode.NONE,
      cameraPreviewMode: json.containsKey("cameraPreviewMode")
          ? CameraPreviewMode.values
              .byName(json["cameraPreviewMode"] as String)
          : CameraPreviewMode.FILL_IN,
    );