AndroidEnvironmentSensorsPlugin

Environmental sensor plugin for flutter
Android only

<br/>supported sensor<br/>

  • TYPE_AMBIENT_TEMPERATURE
  • TYPE_LIGHT
  • TYPE_PRESSURE
  • TYPE_RELATIVE_HUMIDITY
  • TYPE_TEMPERATURE <br/>for more information on environment sensors<br/>

<br/>Usage
Check if sensor is available or not

 AndroidEnvironmentSensors androidEnvironmentSensors =AndroidEnvironmentSensors();
 final exist = await androidEnvironmentSensors.isExist(AndroidEnvironmentSensors.TYPE_LIGHT);

if sensor exist then listen to it

 StreamSubscription  lightSubscription = androidEnvironmentSensors.lightStream.listen((event) {
      print(event);
    });
 

Remember to cancel subscription when done

lightSubscription.cancel();

check Example

Libraries

android_environment_sensors