isFlashAvailable method

Future<bool> isFlashAvailable()

Checks whether the device has a built-in flash (torch) that can be used for illumination during barcode scanning.

Returns a Future that completes with a boolean indicating whether the flash is available.

Example usage:

bool flashAvailable = await _barkoder.isFlashAvailable();
print('Flash available: $flashAvailable');

Implementation

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

  return _methodChannel
      .invokeMethod('isFlashAvailable')
      .then((isAvailable) => isAvailable as bool);
}