mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
56 lines
1.2 KiB
Dart
56 lines
1.2 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
|
|
class DeviceLocationInfo extends Equatable {
|
|
const DeviceLocationInfo({
|
|
this.airQuality,
|
|
this.humidity,
|
|
this.city,
|
|
this.country,
|
|
this.address,
|
|
this.temperature,
|
|
});
|
|
|
|
final double? airQuality;
|
|
final double? humidity;
|
|
final String? city;
|
|
final String? country;
|
|
final String? address;
|
|
final double? temperature;
|
|
|
|
factory DeviceLocationInfo.fromJson(Map<String, dynamic> json) {
|
|
return DeviceLocationInfo(
|
|
airQuality: json['aqi'] as double?,
|
|
humidity: json['humidity'] as double?,
|
|
temperature: json['temperature'] as double?,
|
|
);
|
|
}
|
|
|
|
DeviceLocationInfo copyWith({
|
|
double? airQuality,
|
|
double? humidity,
|
|
String? city,
|
|
String? country,
|
|
String? address,
|
|
double? temperature,
|
|
}) {
|
|
return DeviceLocationInfo(
|
|
airQuality: airQuality ?? this.airQuality,
|
|
humidity: humidity ?? this.humidity,
|
|
city: city ?? this.city,
|
|
country: country ?? this.country,
|
|
address: address ?? this.address,
|
|
temperature: temperature ?? this.temperature,
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [
|
|
airQuality,
|
|
humidity,
|
|
city,
|
|
country,
|
|
address,
|
|
temperature,
|
|
];
|
|
}
|