I have a user object I'm using with scoped model:
class User extends Model {
String name;
String description;
// and a bunch of other fields
User(Map data) {
this.name = data['name'];
this.description = data['description'];
}
void updateUser(Map data) {
// copy and pasted from User constructor
this.name = data['name'];
this.description = data['description'];
notifyListeners();
}
}
Is there a way not have to duplicate the code from the User constructor inside updateUser?