Initial Flutter project added
This commit is contained in:
24
lib/models/user_model.dart
Normal file
24
lib/models/user_model.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
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,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user