Objects are references
Objects act as references
Objects act as references to the instances of the class in memory. That means if you assign one object to another, the other object simply holds a reference to the same object in memory — not a new instance.
So if you have a class like this:
class MyClass {
var myProperty = 1;
}
And you instantiate it like so:
final myObject = MyClass();
final anotherObject = myObject;
Then myObject and anotherObject both reference the same place in memory. Changing myProperty in either object will affect the other because they both reference the same instance:
print(myObject.myProperty); // 1
anotherObject.myProperty = 2;
print(myObject.myProperty); // 2