Practical Recipes¶
In-Memory Storage¶
val storage = MemoryStoreProvider(mutableMapOf())
val enabled = storage.boolean("enabled")
enabled.set(true)
check(enabled.instant() == true)
Persistent Storage¶
Create an AndroidX DataStore instance for the platform, then expose it through
DataStoreProvider.
Required Storage Value¶
Restorable State Delegate¶
Keep persisted state small. Store identifiers and user input, not large object graphs.
One-Shot Request¶
val request = splinter(
strategy = Strategy.oneShot {
request { repository.loadProfile() }
}
)
request.execute()
request.resultHolder.fullFlow.collect { result ->
render(result)
}
Use explicit execution and stop policies when the default behavior does not match the screen lifecycle. See Splinter.