initCamera method

void initCamera()

Implementation

void initCamera() async {
  _channel.setMethodCallHandler(nativeMethodCallHandler);
  _channel.invokeMethod(
      'requestPermission', {"isVideoMode": widget.isVideoMode}).then((value) {
    if (value) {
      if (Platform.isAndroid) {
        _channel.invokeMethod('initCamera', {
          "hasBarcodeReader": widget.hasBarcodeReader,
          "flashMode": _getCharFlashMode(widget.previewFlashMode),
          "isFillScale": _getScaleTypeMode(widget.scaleType),
          "barcodeMode": _getBarcodeModeValue(widget.barcodeFormat),
          "androidCameraMode":
              _getAndroidCameraMode(widget.androidCameraMode),
          "cameraSelector": _getCameraSelector(widget.cameraSelector),
          "isVideoMode": widget.isVideoMode
        });
      } else {
        _channel.invokeMethod('initCamera', {
          "hasBarcodeReader": widget.hasBarcodeReader,
          "flashMode": _getCharFlashMode(widget.previewFlashMode),
          "isFillScale": _getScaleTypeMode(widget.scaleType),
          "barcodeMode": _getBarcodeModeValue(widget.barcodeFormat),
          "cameraSelector": _getCameraSelector(widget.cameraSelector),
          "isVideoMode": widget.isVideoMode
        });
      }
    } else {
      widget.onPermissionDenied!();
    }
  });
}