Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - Immutable and Equatable #22

Open
nhwilly opened this issue Apr 11, 2020 · 1 comment
Open

Question - Immutable and Equatable #22

nhwilly opened this issue Apr 11, 2020 · 1 comment

Comments

@nhwilly
Copy link

nhwilly commented Apr 11, 2020

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants