32 lines
937 B
Dart
32 lines
937 B
Dart
import 'package:equatable/equatable.dart';
|
|
import '../../../../core/utils/json_safe.dart';
|
|
|
|
class DeviceRunStatisticsEntity extends Equatable {
|
|
final String startTime;
|
|
final String endTime;
|
|
final double workArea;
|
|
final double? distance;
|
|
final int time;
|
|
|
|
const DeviceRunStatisticsEntity({
|
|
required this.startTime,
|
|
required this.endTime,
|
|
required this.workArea,
|
|
this.distance,
|
|
required this.time,
|
|
});
|
|
|
|
factory DeviceRunStatisticsEntity.fromJson(Map<String, dynamic> json) {
|
|
return DeviceRunStatisticsEntity(
|
|
startTime: JsonSafe.asString(json['startTime']),
|
|
endTime: JsonSafe.asString(json['endTime']),
|
|
workArea: JsonSafe.asDouble(json['workArea']),
|
|
distance: json['distance'] != null ? JsonSafe.asDouble(json['distance']) : null,
|
|
time: JsonSafe.asInt(json['time']),
|
|
);
|
|
}
|
|
|
|
@override
|
|
List<Object?> get props => [startTime, endTime, workArea, distance, time];
|
|
}
|