30 lines
901 B
Dart
30 lines
901 B
Dart
class StationModel {
|
|
final String hydrogenId;
|
|
final String name;
|
|
final String address;
|
|
final String price;
|
|
final String siteStatusName; // 例如 "维修中"
|
|
final int isSelect; // 新增字段 1是可用 0是不可用
|
|
|
|
StationModel({
|
|
required this.hydrogenId,
|
|
required this.name,
|
|
required this.address,
|
|
required this.price,
|
|
required this.siteStatusName,
|
|
required this.isSelect,
|
|
});
|
|
|
|
// 从 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'] ?? '',
|
|
isSelect: json['isSelect'] as int? ?? 0, // 新增字段的解析,默认为 0
|
|
);
|
|
}
|
|
}
|