MetarWeather constructor
MetarWeather(
- String? code,
- RegExpMatch? match
Implementation
MetarWeather(super.code, RegExpMatch? match) {
if (match != null) {
_intensity = weatherIntensityMap[match.namedGroup('int')];
_description = weatherDescriptionMap[match.namedGroup('desc')];
_obscuration = weatherObscurationMap[match.namedGroup('obsc')];
_other = weatherOtherMap[match.namedGroup('other')];
// Compound precipitation: e.g. 'RASN', 'FZRASN' — split into 2-char codes
final precRaw = match.namedGroup('prec');
if (precRaw != null) {
final codes = RegExp(r'DZ|RA|SN|SG|IC|PL|GR|GS|UP')
.allMatches(precRaw)
.map((m) => m.group(0)!)
.toList();
_precipitationCodes.addAll(codes);
_precipitation =
codes.map((c) => weatherPrecipitationMap[c] ?? c).join(' and ');
}
}
}