relativeHumidity property
double?
get
relativeHumidity
Get the relative humidity as a percentage (0–100) using the
Magnus-Tetens approximation, or null if either value is unavailable.
Implementation
double? get relativeHumidity {
final t = temperatureInCelsius;
final dp = dewpointInCelsius;
if (t == null || dp == null) return null;
// Magnus formula
const a = 17.625;
const b = 243.04;
final gamma = (a * dp) / (b + dp);
final gammaTa = (a * t) / (b + t);
return 100.0 * exp(gamma) / exp(gammaTa);
}