Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
driver_request.dart
Go to the documentation of this file.
1class Station {
2 final String id;
3 final String name;
5 final double latitude;
6 final double longitude;
7 final double quantityInLiters;
8
10 required this.id,
11 required this.name,
12 required this.address,
13 required this.latitude,
14 required this.longitude,
15 required this.quantityInLiters,
16 });
17
18 factory Station.fromJson(Map<String, dynamic> json) {
19 return Station(
20 id: json['id'] as String,
21 name: json['name'] as String,
22 address: json['address'] as String,
23 latitude: (json['latitude'] as num).toDouble(),
24 longitude: (json['longitude'] as num).toDouble(),
25 quantityInLiters: (json['quantityInLiters'] as num).toDouble(),
26 );
27 }
28
29 Map<String, dynamic> toJson() {
30 return {
31 'id': id,
32 'name': name,
33 'address': address,
34 'latitude': latitude,
35 'longitude': longitude,
36 'quantityInLiters': quantityInLiters,
37 };
38 }
39}
40
41class DriverRequest {
42 final String id;
44 final DateTime creationDate;
45 final List<Station> stations;
48
50 required this.id,
51 required this.driverName,
52 required this.creationDate,
53 required this.stations,
54 required this.startPoint,
55 required this.endPoint,
56 });
57
59
60 factory DriverRequest.fromJson(Map<String, dynamic> json) {
61 return DriverRequest(
62 id: json['id'] as String,
63 driverName: json['driverName'] as String,
64 creationDate: DateTime.parse(json['creationDate'] as String),
65 stations: (json['stations'] as List<dynamic>)
66 .map((stationJson) =>
67 Station.fromJson(stationJson as Map<String, dynamic>))
68 .toList(),
69 startPoint: json['startPoint'] as String,
70 endPoint: json['endPoint'] as String,
71 );
72 }
73
74 Map<String, dynamic> toJson() {
75 return {
76 'id': id,
77 'driverName': driverName,
78 'creationDate': creationDate.toIso8601String(),
79 'stations': stations.map((station) => station.toJson()).toList(),
80 'startPoint': startPoint,
81 'endPoint': endPoint,
82 };
83 }
84}
final String address
Station({ required this.id, required this.name, required this.address, required this.latitude, required this.longitude, required this.quantityInLiters, })
Map< String, dynamic > toJson()
final double latitude
final double quantityInLiters
factory Station fromJson(Map< String, dynamic > json)
final String name
final String id
final double longitude
Map< String, dynamic > toJson()
class Partner String
String get(String locale)
final String startPoint
final List< Station > stations
DriverRequest({ required this.id, required this.driverName, required this.creationDate, required this.stations, required this.startPoint, required this.endPoint, })
final String endPoint
final DateTime creationDate
final String driverName
int get numberOfStations