25 lines
596 B
Dart
25 lines
596 B
Dart
|
|
class UserModel {
|
||
|
|
final int? id;
|
||
|
|
final String? customerId;
|
||
|
|
final String? customerName;
|
||
|
|
final String? email;
|
||
|
|
|
||
|
|
UserModel({this.id, this.customerId, this.customerName, this.email});
|
||
|
|
|
||
|
|
factory UserModel.fromJson(Map<String, dynamic> json) {
|
||
|
|
return UserModel(
|
||
|
|
id: json['id'],
|
||
|
|
customerId: json['customer_id'] ?? json['customerId'],
|
||
|
|
customerName: json['customer_name'] ?? json['name'],
|
||
|
|
email: json['email'],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
Map<String, dynamic> toJson() => {
|
||
|
|
'id': id,
|
||
|
|
'customer_id': customerId,
|
||
|
|
'customer_name': customerName,
|
||
|
|
'email': email,
|
||
|
|
};
|
||
|
|
}
|