light 4.1.0 copy "light: ^4.1.0" to clipboard
light: ^4.1.0 copied to clipboard

PlatformAndroid

Plugin for collecting data from the ambient light sensor on Android.

Light #

pub package

A Flutter plugin for collecting ambient light data from the Android Environment Sensors.

Install #

Add light as a dependency in the pubspec.yaml file.

For help on adding as a dependency, view the documentation.

Usage #

Use the singleton Light() to listen on the lightSensorStream stream.

  StreamSubscription<int>? _lightEvents;

  void startListening() {
    try {
      _lightEvents =
          Light().lightSensorStream.listen((luxValue) => setState(() {
                // Do something with the lux value
              }));
    } catch (exception) {
      print(exception);
    }
  }

  void stopListening() {
    _lightEvents?.cancel();
  }
24
likes
160
points
4.75k
downloads

Publisher

verified publishercachet.dk

Weekly Downloads

Plugin for collecting data from the ambient light sensor on Android.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on light