turnOnOrOffFlashlight method

  1. @override
Future<bool> turnOnOrOffFlashlight(
  1. bool isOn
)

Turn on or off the flashlight.
isOn true if you want to turn on the flashlight, false to turn it off.
Return true if the operation was successful. Otherwise, this function returns false.

Implementation

@override
Future<bool> turnOnOrOffFlashlight(bool isOn) async {
  var params = <String, dynamic>{};
  params.putIfAbsent("isOn", () => isOn);
  return await methodChannel
      .invokeMethod<bool>('turnOnOrOffFlashlight', params)
      .then<bool>((bool? value) => value ?? false);
}