Files
Client/lib/storage/rmv_settings.dart
T

42 lines
1.0 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
import '../api/connect/rmv/rmv_models.dart';
part 'rmv_settings.g.dart';
@JsonSerializable(explicitToJson: true)
class RmvSettings {
List<StopLocation> favoriteStations;
List<StopLocation> recentStations;
List<RecentTripQuery> recentTripQueries;
static const int maxRecents = 10;
RmvSettings({
this.favoriteStations = const [],
this.recentStations = const [],
this.recentTripQueries = const [],
});
factory RmvSettings.fromJson(Map<String, dynamic> json) =>
_$RmvSettingsFromJson(json);
Map<String, dynamic> toJson() => _$RmvSettingsToJson(this);
}
@JsonSerializable(explicitToJson: true)
class RecentTripQuery {
final StopLocation from;
final StopLocation to;
final int timestampMs;
RecentTripQuery({
required this.from,
required this.to,
required this.timestampMs,
});
factory RecentTripQuery.fromJson(Map<String, dynamic> json) =>
_$RecentTripQueryFromJson(json);
Map<String, dynamic> toJson() => _$RecentTripQueryToJson(this);
}