https://kotlinlang.org logo
#ballast
Title
# ballast
c

Casey Brooks

01/20/2023, 4:43 PM
Hey everyone, I’m looking to make some improvements to the SavedStateAdapter such that you could send multiple Inputs and/or Events after the State has been restored, but I’m not sure the best DSL to use for this. I’d love to get some feedback on the potential ways this could be implemented, and votes on which option you’d prefer. My suggestions are in the 🧵, but feel free to make other suggestions.
Option 1: continue using
restore()
callback, and add functions to
RestoreStateScope
to send Inputs/Events
Option 2: Deprecate
restore()
function and add a new callback with a new return type, which contains the restored State along with the Inputs/Event to send afterwards
r

Robert Jaros

01/20/2023, 4:50 PM
I like option 1, but I would use just
postInput
and
postEvent
names for the functions.
c

Casey Brooks

01/20/2023, 4:54 PM
I was thinking the
*AfterRestore
naming would help clarify that they don’t actually get sent until after the method returns and the returned State is fully restored, but it may not be necessary to be so explicit
a

ayodele

01/21/2023, 8:16 AM
I vote option 1 too.
4 Views