|
|
@ -28,9 +28,21 @@ class TrainData with _$TrainData { |
|
|
|
|
|
|
|
|
|
|
|
factory TrainData.fromJson(Map<String, dynamic> json) => _$TrainDataFromJson(json); |
|
|
|
factory TrainData.fromJson(Map<String, dynamic> json) => _$TrainDataFromJson(json); |
|
|
|
|
|
|
|
|
|
|
|
List<TrainDataStation> get stations => groups.first.stations; |
|
|
|
TrainDataGroup get idealGroup { |
|
|
|
TrainDataRoute get route => groups.first.route; |
|
|
|
var result = groups.first; |
|
|
|
TrainDataStatus? get status => groups.first.status; |
|
|
|
|
|
|
|
|
|
|
|
for (final group in groups) { |
|
|
|
|
|
|
|
if (result.stations.map((s) => s.linkName).toSet().difference(group.stations.map((s) => s.linkName).toSet()).isEmpty) { |
|
|
|
|
|
|
|
result = group; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<TrainDataStation> get stations => idealGroup.stations; |
|
|
|
|
|
|
|
TrainDataRoute get route => idealGroup.route; |
|
|
|
|
|
|
|
TrainDataStatus? get status => idealGroup.status; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@freezed |
|
|
|
@freezed |
|
|
|