import 'package:equatable/equatable.dart'; class RangeOfAqi extends Equatable { final DateTime date; final List data; const RangeOfAqi({ required this.data, required this.date, }); factory RangeOfAqi.fromJson(Map json) { return RangeOfAqi( date: DateTime.parse(json['date'] as String), data: (json['data'] as List) .map((e) => RangeOfAqiValue.fromJson(e as Map)) .toList(), ); } @override List get props => [data, date]; } class RangeOfAqiValue extends Equatable { final String type; final double min; final double average; final double max; const RangeOfAqiValue({ required this.type, required this.min, required this.average, required this.max, }); factory RangeOfAqiValue.fromJson(Map json) { return RangeOfAqiValue( type: json['type'] as String, min: (json['min'] as num).toDouble(), average: (json['average'] as num).toDouble(), max: (json['max'] as num).toDouble(), ); } @override List get props => [type, min, average, max]; }