catchBoomerangWithLifecycleEvent
Extension function for Fragment that sets up a lifecycle observer to catch a boomerang value when a specific lifecycle event occurs. This function should be called in the Fragment's onCreate method to not multiply the observers. The observer will try to catch the value when the specified lifecycle event occurs and will remove itself when the fragment is destroyed. Example usage
Parameters
The key to try to catch the value for
The lifecycle event that triggers the catch attempt (default is ON_START)
The BoomerangCatcher to use for catching the value
Throws
if the lifecycleEvent is not ON_START or ON_RESUME
if called after Fragment's onCreate, if the Fragment is not attached to an Activity, if the Activity does not implement BoomerangStoreHost, or if the BoomerangStore is not initialized
Extension function for Fragment that sets up a lifecycle observer to catch a boomerang value when a specific lifecycle event occurs. This is an inline version that accepts a lambda function instead of a BoomerangCatcher. This function should be called in the Fragment's onCreate method to not multiply the observers. Example usage
Parameters
The key to try to catch the value for
The lifecycle event that triggers the catch attempt (default is ON_START)
Lambda function that will be called with the caught Boomerang value
Throws
if the lifecycleEvent is not ON_START or ON_RESUME
if called after Fragment's onCreate, if the Fragment is not attached to an Activity, if the Activity does not implement BoomerangStoreHost, or if the BoomerangStore is not initialized