Skip to main content

Flashlight

Flashlight

Use this component to adjust the device's flashlight intensity or toggle the flashlight On/Off.

To get started using it, you must use KmpFlashlight. All functions are thread safe and main thread safe.

To toggle the flashlight ON/OFF, see below:


_5
// turns flash light on
_5
KmpFlashlight.turnOnFlashlight()
_5
_5
// turns flashlight off
_5
KmpFlashlight.turnOffFlashlight()

To adjust the Flashlight device intensity please use the following (For android this will only work on Android 11 devices or above)


_1
KmpFlashlight.turnOnFlashLightWithAdjustableStrength(FlashLightMode.High)


_8
// Flashlight Mode comes with these options
_8
FlashLightMode {
_8
Low,
_8
Medium,
_8
High,
_8
Max,
_8
Default
_8
}

Any Setup Required?

For android please add this into your manifest:


_1
<uses-permission android:name="android.permission.FLASHLIGHT" />