I have a simple programme in dart to test out if variables assigned hold reference.
class User{
int? id;
String? name;
int? age;
User(this.id, this.name, this.age);
}
User user1 = User(1,'Harry', 21);
User user2 = user1;
user2.name = 'James';
print(user1.name); //prints out James
print(user2.name); //prints out James
I read that Dart is an Assigned by value language. So why does user1.name have a value of James and not Harry even if it was not explicitly changed?.