Function

mapSaver

The Saver implementation which allows to represent your class as a map of values which can be saved individually.

mapSaver

Source set: Common
public fun <T> mapSaver(
    save: SaverScope.(value: T) -> Map<String, Any?>,
    restore: (Map<String, Any?>) -> T?,
): Saver<T, Any>

The Saver implementation which allows to represent your class as a map of values which can be saved individually.

What types can be saved is defined by SaveableStateRegistry, by default everything which can be stored in the Bundle class can be saved.

You can use it as a parameter for rememberSaveable.

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: