flutter_light 0.0.2 copy "flutter_light: ^0.0.2" to clipboard
flutter_light: ^0.0.2 copied to clipboard

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
    }
}
  
copied to clipboard
0
likes
40
points
30
downloads

Publisher

verified publishercachet.dk

Weekly Downloads

2024.09.18 - 2025.04.02

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.

Homepage

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_light