38 lines
857 B
Dart
38 lines
857 B
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'] as String,
|
|
name: json['name'] as String,
|
|
uniqueId: json['uniqueId'] as String,
|
|
email: json['email'] as String,
|
|
isVerified: json['isVerified'] as bool,
|
|
);
|
|
}
|
|
|
|
// 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,
|
|
};
|
|
}
|
|
}
|