Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
collection_model.dart
Go to the documentation of this file.
1import 'package:easy_localization/easy_localization.dart';
2
3import '../enums/collection_status.dart';
4import '../enums/collection_priority.dart';
5import '../entities/collection_entity.dart';
6
9 super.id,
10 super.address,
11 super.dateStart,
12 super.datePlanned,
13 super.instructions,
14 super.lat,
15 super.lng,
16 super.order,
17 super.pickups,
18 super.priority,
19 super.reference,
20 super.restaurant,
21 super.restaurantId,
22 super.slot,
23 super.status,
24 super.volume,
25 super.volumeCollected,
26 super.startTime,
27 super.endTime
28 });
29
30 factory CollectionModel.fromJson(Map<String, dynamic> json) {
31 return CollectionModel(
32 id: json['id'],
33 address: json['address'],
34 dateStart: json['dateStart'] != null
35 ? DateFormat('dd/MM/yyyy').format(DateTime.parse(json['dateStart']))
36 : null,
37 datePlanned: json['datePlanned'] != null
38 ? DateFormat('dd/MM/yyyy').format(DateTime.parse(json['datePlanned']))
39 : null,
40 instructions: json['instructions'],
41 lat: json['lat'],
42 lng: json['lng'],
43 order: json['order'],
44 pickups: json['pickups'],
45 priority: json['priority'] != null
46 ? collectionPriorityFromJson(json['priority'])
47 : null,
48 reference: json['reference'],
49 restaurant: json['restaurant'],
50 restaurantId: json['restaurantId'],
51 slot: json['slot'],
52 status: json['status'] != null
53 ? collectionStatusFromJson(json['status'])
54 : null,
55 volume: json['volume']?.toDouble(),
56 volumeCollected: json['volumeCollected']?.toDouble(),
57 endTime: json['endTime'],
58 startTime: json['startTime'],
59 );
60 }
61}
const CollectionModel({ super.id, super.address, super.dateStart, super.datePlanned, super.instructions, super.lat, super.lng, super.order, super.pickups, super.priority, super.reference, super.restaurant, super.restaurantId, super.slot, super.status, super.volume, super.volumeCollected, super.startTime, super.endTime })
final int restaurantId
final String volumeCollected
final String restaurant
final String address