catchSerializableWithLifecycleEvent

inline fun <T : @Serializable Any> Fragment.catchSerializableWithLifecycleEvent(key: String, lifecycleEvent: Lifecycle.Event = Lifecycle.Event.ON_START, crossinline catcher: (T) -> Boolean)

Extension function for Fragment that catches serializable objects of type T at a specific lifecycle event.

This function uses Kotlinx Serialization to deserialize the caught object before passing it to the catcher function. The catcher function returns a boolean indicating whether the object was successfully handled.

Parameters

T

The type of serializable object to catch

key

The unique identifier for this catcher, used to match the thrown object

lifecycleEvent

The lifecycle event at which to catch the object, defaults to Lifecycle.Event.ON_START

catcher

A function that processes the caught object and returns true if it was handled successfully


inline fun <T : @Serializable Any> Fragment.catchSerializableWithLifecycleEvent(lifecycleEvent: Lifecycle.Event = Lifecycle.Event.ON_START, crossinline catcher: (T) -> Boolean)

Extension function for Fragment that catches serializable objects of type T at a specific lifecycle event.

This overload automatically uses the qualified name of type T as the key. The catcher function returns a boolean indicating whether the object was successfully handled.

Parameters

T

The type of serializable object to catch

lifecycleEvent

The lifecycle event at which to catch the object, defaults to Lifecycle.Event.ON_START

catcher

A function that processes the caught object and returns true if it was handled successfully