Question - Immutable and Equatable
nhwilly opened this issue · 1 comments
nhwilly commented
I am using equatable
as you describe in your course.
How do you manage when one class contains another and the contained class gets updated?
All the examples I find use a copyWith
approach with non-positional arguments.
Is this the best practices way to do it?
TIA
cervonwong commented
Yes. The the containing class will not know that there is a new, updated instance of the contained class. So you will have to update the containing class by passing the updated contained class through the copyWith method.