hasFlash method

  1. @override
Future<bool> hasFlash({
  1. String? deviceId,
})
override

Check if the current camera has flash/torch support

If deviceId is provided, checks flash support for that specific device. Otherwise, checks the currently active camera.

Returns true if flash is available, false otherwise. Returns false if no camera is initialized or device not found.

Implementation

@override
Future<bool> hasFlash({String? deviceId}) async {
  try {
    final Map<String, dynamic>? arguments =
        deviceId != null ? {'deviceId': deviceId} : null;

    final result =
        await methodChannel.invokeMethod<bool>('hasFlash', arguments);
    return result ?? false;
  } catch (e) {
    return false;
  }
}