loloof64
04/11/2021, 10:14 AMrememberSaveable
, but how should I build such object ? Let's say for data class Point(val x: Int, val y:Int)
? Because there is not any example in the documentation, and I did not understand this sentence (build a custom object saver
), what interface should the saver have ? What is the Android class/object responsible for such interface ? Should I create a Bundle
myself ?loloof64
04/11/2021, 10:27 AMloloof64
04/11/2021, 12:04 PMloloof64
04/11/2021, 12:05 PMJorkoh
04/11/2021, 12:13 PMmapSaver
sample would work nicely for this case but doing it with a String also works 👍Albert Chang
04/11/2021, 2:06 PMrememberSaveable(stateSaver = saver) { mutableStateOf(state) }
and remove the MutableState
type from your saver.loloof64
04/11/2021, 3:19 PMmitableStateOf
from the saver, but this time I get an error Type 'DndData' has no method 'getValue(Nothing?, KProperty<*>)' and thus it cannot serve as a delegate
.Albert Chang
04/11/2021, 3:57 PMmutableStateOf()
in rememberSaveable
. If you didn't, check if you are using the correct overload of rememberSaveable
.loloof64
04/11/2021, 4:01 PMinferred data is MutableState<DndData> but type DndData expected
.Albert Chang
04/11/2021, 4:02 PMstateSaver
parameter.loloof64
04/11/2021, 6:47 PMby
again.