mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Created a model class for loading device location data.
This commit is contained in:
58
lib/pages/analytics/models/device_location_info.dart
Normal file
58
lib/pages/analytics/models/device_location_info.dart
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
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['airQuality'] as double?,
|
||||||
|
humidity: json['humidity'] as double?,
|
||||||
|
city: json['city'] as String?,
|
||||||
|
country: json['country'] as String?,
|
||||||
|
address: json['address'] as String?,
|
||||||
|
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,
|
||||||
|
];
|
||||||
|
}
|
Reference in New Issue
Block a user