userModel
class UserModel1 {
late String id;
late String fullname;
late String email;
UserModel1({required this.id, required this.fullname, required this.email});
/// Map to Object
UserModel1.fromMap(Map<String, dynamic> map) { //here, creating Constructor named "fromMap()"
this.id = map["id"];
this.fullname = map["fullname"];
this.email = map["email"];
}
/// Object to Map
Map<String, dynamic> toMap() {
return {
"id" : this.id,
"fullname" : this.fullname,
"email" : this.email,
};
}
}
Comments
Post a Comment