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

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter