parcelizeStatePlugin

inline fun <T : Parcelable, S, S : MVIState, I : MVIIntent, A : MVIAction> parcelizeStatePlugin(handle: SavedStateHandle, context: CoroutineContext = Dispatchers.IO, key: String = key<T>(), behaviors: Set<<Error class: unknown class>> = SaveBehavior.Default, resetOnException: Boolean = true, name: String? = "", noinline recover: suspend (Exception) -> T? = ThrowRecover): LazyPlugin<S, I, A>

Creates a new saveStatePlugin that saves the state value of given type T into a handle. Your state must be Parcelable to use this function.

  • By default, this plugin will use the class name of the state as a key for the savedStateHandle.

  • The state will be written in full, so be careful not to exceed the maximum parcel size, or use MapSaver and saveStatePlugin manually to map the state, or serialize the state to a json using serializeStatePlugin.

See the documentation for saveStatePlugin for docs on other parameters.

See also