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

Popular posts from this blog

Pagination with Bloc Pattern in Flutter

Pagination First Practical in Flutter

ExpansionPanel with ExpansionPanelList with Complete Collapse Operation in Flutter