rd-android-app/lib/models/user_model.dart
saritabirare 215877afc4 1)Order Place api Integration
2)Confirm Order api Integration
3)get Oder api Integration
2024-09-06 14:39:40 +05:30

44 lines
1.0 KiB
Dart

class UserModel {
String id;
String name;
String uniqueId;
String email;
bool isVerified;
UserModel({
required this.id,
required this.name,
required this.uniqueId,
required this.email,
required this.isVerified,
});
// Factory constructor to create an instance of UserModel from a JSON map
factory UserModel.fromJson(Map<String, dynamic> json) {
return UserModel(
id: json['_id'] ??"",
name: json['name'] ??"Sarita",
uniqueId: json['uniqueId'] ??"1234",
email: json['email'] ??"",
isVerified: json['isVerified'] as bool? ??false,
);
}
// Method to convert an instance of UserModel to a JSON map
Map<String, dynamic> toJson() {
return {
'_id': id,
'name': name,
'uniqueId': uniqueId,
'email': email,
'isVerified': isVerified,
};
}
// Override toString() to provide a readable output
@override
String toString() {
return 'UserModel{id: $id, name: $name, uniqueId: $uniqueId, email: $email, isVerified: $isVerified}';
}
}