setFlashEnabled method

Future<void> setFlashEnabled(
  1. bool enabled
)

Enables or disables the device's flash (torch) for illumination during barcode scanning.

enabled: A boolean indicating whether to enable the flash.

Example usage:

bool flashEnabled = true;
await _barkoder.setFlashEnabled(flashEnabled);
print('Flash enabled: $flashEnabled');

Implementation

Future<void> setFlashEnabled(bool enabled) {
  if (_isBarkoderViewNotMounted) {
    return Future.error(PlatformException(
        code: BarkoderErrors.barkoderViewNotMounted,
        message: BarkoderErrors.barkodeViewNotMountedDesc));
  }

  return _methodChannel.invokeMethod('setFlashEnabled', enabled);
}