Hi again! How do I change a specific value in a list with optics @simon.vergauwen?
Copy code
@optics data class Foo(val list: List<Bar>)
@optics data class Bar(val id: Int, val isChecked: Boolean)
// I need to change isChecked for say, a Bar that's id (NOT index in list) is 2?
s
simon.vergauwen
08/28/2023, 6:30 AM
Hey @dave08,
Sorry for the late reply. I was out in August.
You should be able to do this with the
There's quite a few things that aren't clear from the current docs on optics... like the difference between
index
and
at
in this case, and I think that the default implementations of index use the index in the list... whereas I needed to use an index from the object itself, so I had to implement my own