-
@Stable() public interface ResultBackNavigator<R extends Object>Navigator that allows navigating back while passing a result of type R.
If declared as a parameter of a
@Destinationannotated Composable, Compose Destinations will provide a correct implementation.If you're manually calling that Composable, then you can use com.ramcosta.composedestinations.scope.resultBackNavigator extension function to get a correctly typed implementation. To get a correctly typed com.ramcosta.composedestinations.navargs.DestinationsNavType in this case, check what the generated Destination object uses.
Type safety related limitations (compile time enforced):
R must be a valid navigation argument type.
Each annotated Composable can have at most one parameter of type ResultBackNavigator
-
-
Method Summary
Modifier and Type Method Description abstract UnitnavigateBack(R result)Goes back to previous destination sending result. abstract UnitnavigateBack()Goes back to previous destination sending the last result set with setResult or just navigating if no result was set. abstract UnitsetResult(R result)Sets a result to be sent on the next navigateBack call. -
-
Method Detail
-
navigateBack
abstract Unit navigateBack(R result)
Goes back to previous destination sending result.
It uses NavController.navigateUp internally to go back.
Check com.ramcosta.composedestinations.result.ResultRecipient to see how to get the result.
-
navigateBack
abstract Unit navigateBack()
Goes back to previous destination sending the last result set with setResult or just navigating if no result was set.
It uses NavController.navigateUp internally to go back.
-
setResult
abstract Unit setResult(R result)
Sets a result to be sent on the next navigateBack call.
Check com.ramcosta.composedestinations.result.ResultRecipient to see how to get the result.
If multiple calls are done, the last one will be the result sent back. This also applies if you call navigateBack (with result) after calling this.
-
-
-
-