Skip to content

Flashlight

Flashlight #

Bases: Service

A control to use FlashLight. Works on iOS and Android. Based on torch_light Flutter widget (https://pub.dev/packages/torch_light).

Note

This control is a non-visual and should be added to page.services list before it can be used.

data: Any = skip_field() #

Arbitrary data of any type that can be attached to a control.

key: str | int | float | bool | ValueKey | ScrollKey | None = None #

on = False #

Whether the flashlight is currently turned on.

on_error: ft.OptionalControlEventHandler[Flashlight] = None #

Fires when an error occurs.

The data property of the event handler argument contains information on the error.

page: Page | PageView | None #

The page (of type Page or PageView) to which this control belongs to.

parent: BaseControl | None #

The direct ancestor(parent) of this control.

It defaults to None and will only have a value when this control is mounted (added to the page tree).

The Page control (which is the root of the tree) is an exception - it always has parent=None.

is_available_async() #

Checks if the flashlight is available on the device.

toggle() #

Toggles the flashlight on and off.

toggle_async() #

Toggles the flashlight on and off.

turn_off() #

Turns the flashlight off.

turn_off_async() #

Turns the flashlight off.

turn_on() #

Turns the flashlight on.

turn_on_async() #

Turns the flashlight on.