class Record{
int data;
Record(this.data);
}
class BigRecord{
Record record;
BigRecord(this.record);
}
void main(){
BigRecord big1 = BigRecord(Record(20));
BigRecord big = BigRecord(Record(23));
big1 = big;
big.record.data=22;
print(big1.record.data); //22
}
How can I copy the object without just referring to the same location? I just want to pass the value of big to big1. But it passes the location of big. And when I change big it also changes the big1. What can I do to just change big without changing big1?
Passing big.record.data works but that's not what I want. Because this is just a small reference for my issue.