simple question here but wondering if anyone can offer the right solution. I want to take in an object of the same type as my current class, and set all my fields to that object's fields, without individually setting each out. Is there a way to do that easily or no?
Eg.,
User({required this.uid}) {
Database().getUser(uid).listen((User user) async {
displayName = user?.displayName;
email = user?.email;
phoneNumber = user?.phoneNumber;
photoURL = user?.photoURL;
notifyListeners();
});
}
The above works but isn't clean. I want to be able to do the above in 1 line, eg., set
this.user = user
Not sure if this is possible. Thanks!