hasTorch property

bool get hasTorch

Returns whether the device has a torch.

Throws an error if the controller is not initialized.

Implementation

bool get hasTorch {
  final hasTorch = hasTorchState.value;
  if (hasTorch == null) {
    throw const MobileScannerException(
      errorCode: MobileScannerErrorCode.controllerUninitialized,
    );
  }

  return hasTorch;
}