allowed RangeOfAqiValue values to be nullable, and if they were null they fallback to zero.

This commit is contained in:
Faris Armoush
2025-06-19 14:24:49 +03:00
parent 7172a0e3fb
commit ad5ada9d55

View File

@ -38,9 +38,9 @@ class RangeOfAqiValue extends Equatable {
factory RangeOfAqiValue.fromJson(Map<String, dynamic> json) { factory RangeOfAqiValue.fromJson(Map<String, dynamic> json) {
return RangeOfAqiValue( return RangeOfAqiValue(
type: json['type'] as String, type: json['type'] as String,
min: (json['min'] as num).toDouble(), min: (json['min'] as num? ?? 0).toDouble(),
average: (json['average'] as num).toDouble(), average: (json['average'] as num? ?? 0).toDouble(),
max: (json['max'] as num).toDouble(), max: (json['max'] as num? ?? 0).toDouble(),
); );
} }