27 lines
724 B
Dart
27 lines
724 B
Dart
class StationModel {
|
|
final String hydrogenId;
|
|
final String name;
|
|
final String address;
|
|
final String price;
|
|
final String siteStatusName; // 例如 "维修中"
|
|
|
|
StationModel({
|
|
required this.hydrogenId,
|
|
required this.name,
|
|
required this.address,
|
|
required this.price,
|
|
required this.siteStatusName,
|
|
});
|
|
|
|
// 从 JSON map 创建对象的工厂构造函数
|
|
factory StationModel.fromJson(Map<String, dynamic> json) {
|
|
return StationModel(
|
|
hydrogenId: json['hydrogenId'] ?? '',
|
|
name: json['name'] ?? '未知站点',
|
|
address: json['address'] ?? '地址未知',
|
|
price: json['price']?.toString() ?? '0.00',
|
|
siteStatusName: json['siteStatusName'] ?? '',
|
|
);
|
|
}
|
|
}
|