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

How to change data in complex depth attributes of models? #58

Open
jessicamrbr opened this issue Jul 28, 2023 · 1 comment
Open

How to change data in complex depth attributes of models? #58

jessicamrbr opened this issue Jul 28, 2023 · 1 comment

Comments

@jessicamrbr
Copy link

Considering a case where I have a patient with 3 names, and I want to change the "use" of the second index in the list. Working with copyWith can be tricky.

Looking at examples in other elements where the depth can be even greater, the complexity of manipulating the elements can get worse.

@Dokotela
Copy link
Collaborator

Your question is a good one, but unfortunately not one I have a great answer to. Freezed has many benefits, but since it is immutable you do run into these issues. I've considered trying to allow a search/edit function of the fhir_path package, but it would certainly require quite a bit of work.

There are times I've resorted to turning something into the Json map editing that, and then turning it back into the Dart class. It's definitely not the most elegant though.

I'm sorry I don't have a better solution at the moment. I'll leave this open though in case anyone else wants to chime in with suggestions.

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