Package 

Interface OpenResultRecipient


  • @Stable() 
    public interface OpenResultRecipient<R extends Object>
    
                        

    Recipient where you can install a listener to be notified of results (of type R) from an non-determined com.ramcosta.composedestinations.spec.DestinationSpec. !!! ATTENTION !!! - prefer ResultRecipient. Use this only when your recipient is in a module that doesn't depend on the corresponding ResultBackNavigator.

    If declared as a parameter of a @Destination annotated Composable, you need to manually call that Composable and pass the correct typed ResultRecipient by calling com.ramcosta.composedestinations.result.resultRecipient with the correct type arguments.

    Type safety related limitations (compile time enforced):

    • R must be a valid navigation argument type.

    • Method Detail

      • onNavResult

        @Composable() abstract Unit onNavResult(Function1<NavResult<R>, Unit> listener)

        Install a listener that will be called when the origin destination finishes. NavResult will either contain a specific result R for NavResult.Value or it will be NavResult.Canceled if that destination finishes without setting any result.

        Implementation makes sure to only do something the first time it is called, so, no need to worry about recomposition.

        listener will not be called from a Compose scope, it should be treated as a normal button click listener, you can navigate or call a method on a view model, for example.