Files
flutterApp/lib/features/devices/domain/entities/device_run_hostrity_entity.dart

31 lines
970 B
Dart

import 'package:equatable/equatable.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: json['startTime'] as String,
endTime: json['endTime'] as String,
workArea: (json['workArea'] as num).toDouble(),
distance: json['distance'] != null ? (json['distance'] as num).toDouble() : null,
time: json['time'] as int,
);
}
@override
List<Object?> get props => [startTime, endTime, workArea, distance, time];
}