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

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

Light #

pub package

A Flutter plugin for collecting data from the ambient light sensor on Android.

Install #

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

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

Usage #

Instantiate an instance of the Light() plugin and listen on the lightSensorStream stream.

  Light? _light;
  StreamSubscription? _subscription;

  void onData(int luxValue) async {
    print("Lux value: $luxValue");
  }


  void startListening() {
    _light = Light();
    try {
      _subscription = _light?.lightSensorStream.listen(onData);
    } on LightException catch (exception) {
      print(exception);
    }
  }

  void stopListening() {
    _subscription?.cancel();
  }
22
likes
130
pub points
86%
popularity

Publisher

verified publishercachet.dk

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on light