Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
req_create_driver_collection_model.dart
Go to the documentation of this file.
1import '../../../domain/entities/req/req_create_driver_collection_entity.dart';
2
5 required super.collectionPoints,
6 required super.user,
7 });
8
12 collectionPoints: entity.collectionPoints
13 .map((point) => CollectionPointModel.fromEntity(point))
14 .toList(),
15 user: UserModel.fromEntity(entity.user),
16 );
17 }
18
19 Map<String, dynamic> toJson() {
20 return {
21 'collectionPoints': collectionPoints
22 .map((point) => (point as CollectionPointModel).toJson())
23 .toList(),
24 'user': (user as UserModel).toJson(),
25 };
26 }
27
28 factory ReqCreateDriverCollectionModel.fromJson(Map<String, dynamic> json) {
30 collectionPoints: (json['collectionPoints'] as List)
31 .map((point) => CollectionPointModel.fromJson(point))
32 .toList(),
33 user: UserModel.fromJson(json['user']),
34 );
35 }
36}
37
40 required super.id,
41 });
42
43 factory CollectionPointModel.fromEntity(CollectionPointEntity entity) {
45 id: entity.id,
46 );
47 }
48
49 Map<String, dynamic> toJson() {
50 return {
51 'id': id,
52 };
53 }
54
55 factory CollectionPointModel.fromJson(Map<String, dynamic> json) {
57 id: (json['id'] as num?)?.toInt() ?? 0,
58 );
59 }
60}
61
62class UserModel extends UserEntity {
63 const UserModel({
64 required super.id,
65 });
66
67 factory UserModel.fromEntity(UserEntity entity) {
68 return UserModel(
69 id: entity.id,
70 );
71 }
72
73 Map<String, dynamic> toJson() {
74 return {
75 'id': id,
76 };
77 }
78
79 factory UserModel.fromJson(Map<String, dynamic> json) {
80 return UserModel(
81 id: (json['id'] as num?)?.toInt() ?? 0,
82 );
83 }
84}
factory ReqCreateDriverCollectionModel fromJson(Map< String, dynamic > json)
const ReqCreateDriverCollectionModel({ required super.collectionPoints, required super.user, })
factory ReqCreateDriverCollectionModel fromEntity(ReqCreateDriverCollectionEntity entity)
Map< String, dynamic > toJson()
const UserModel({ required super.id, })
Map< String, dynamic > toJson()
const CollectionPointEntity({ required this.id, })
class ReqCreateDriverCollectionModel extends ReqCreateDriverCollectionEntity CollectionPointModel({ required super.id, })