isTorchAvailable static method

Future<bool> isTorchAvailable()

Returns true if the device has a torch available, false otherwise.

Throws an EnableTorchException if the process encounters an error.

Implementation

static Future<bool> isTorchAvailable() async {
  try {
    return await _channel.invokeMethod(_nativeEventIsTorchAvailable) as bool;
  } on PlatformException catch (e) {
    throw EnableTorchException(message: e.message);
  }
}