light 0.0.6 light: ^0.0.6 copied to clipboard
A Flutter plugin for probing data from the light sensor using a platform channel. Works for Android only, since the light sensor API is not available on iOS.
light #
A light sensor plugin for Flutter, reads the intensity of light in lux, and reports this number back. The API for getting the current light exposure is only available on Android devices, and the plugin will therefore not work for iOS devices.
Install #
Add light
as a dependency in pubspec.yaml
.
For help on adding as a dependency, view the documentation.
Usage #
Al incoming data points are streamed with a StreamSubscription
which is set up by calling the listen()
method on a Light
object.
Given a method _onData(int lux)
the subscription can be set up as follows:
Light _light = new Light();
_light.listen(_onData);
The stream can also be cancelled again by calling the cancel()
method:
_light.cancel();