getSensorAvailable method

Future<bool> getSensorAvailable(
  1. SensorType sensorType
)

Check for the availability of device sensor by sensor type.

Implementation

Future<bool> getSensorAvailable(SensorType sensorType) async {
  if (sensorType == SensorType.AmbientTemperature)
    return await _methodChannel.invokeMethod('isSensorAvailable', 13);
  if (sensorType == SensorType.Humidity)
    return await _methodChannel.invokeMethod('isSensorAvailable', 12);
  if (sensorType == SensorType.Light)
    return await _methodChannel.invokeMethod('isSensorAvailable', 5);
  if (sensorType == SensorType.Pressure)
    return await _methodChannel.invokeMethod('isSensorAvailable', 6);

  return false;
}