flutter_light 0.0.2
flutter_light: ^0.0.2

Flutter Android iOS

A pedometer plugin for retrieving the light sensor data in Lux. Works for Android only, since the light sensor API is not available on iOS.

flutter_light_example #

A pedometer plugin for retrieving the light sensor data in Lux. Works for Android only, since the light sensor API is not available on iOS.

Usage #

class MyClass {
  String _luxString = 'Unknown';
  StreamSubscription<int> _subscription;
  Light _light;
      
    // Platform messages are asynchronous, so we initialize in an async method.
    void someSetupFunction() {
      _light = new Light();
     _subscription = _light.lightSensorStream.listen(_onData,
             onError: _onError, onDone: _onDone, cancelOnError: true);
    }
    
    void _onData(int luxValue) async {
    // Do something with the luxValue
    }
    
    void _onDone() {
    // Handle finish
    }
    
    void _onError(error) {
    // Handle the error
    }
}
  
0
likes
80
pub points
32%
popularity

Publisher

cachet.dk

A pedometer plugin for retrieving the light sensor data in Lux. Works for Android only, since the light sensor API is not available on iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_light