Files
flutterApp/lib/features/devices/domain/entities/device_run_hostrity_entity.dart
2026-09-15 08:51:44 +08:00

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];
}