Navigation
RoutePath
A class that defines a path to the screen. The properties of this class are parameters that you want to send to the screen. Use a simple class when the path doesn't provide any parameters to the screen. Use a data class when you want to pass one or more parameters. Avoid passing heavy data like images or long arrays through it. It is usually used to pass small portions of data such as IDs or filter parameters.
Examples:
class MainPath: RoutePath //Simple path
data class StepPath(val step: Int): RoutePath //Path with parameters
data class DialogPath(val title: String = "",
val message: String = "",
val okBtn: String = "",
val cancelBtn: String = ""): RoutePathResult<Boolean> //Path with parameters that returns Boolean valueRouteController
A class that connects RoutePath, Screen, and serves to implement custom routing logic. This class is marked with the @Route annotation and implements one of the children of the RouteControllerInterface. Currently, we have four predefined RouteController classes:
Simple with only Fragment or Compose as view
RouteControllerWith only Fragment or Compose as View and Dagger injection
RouteControllerC. The letter C means Component that passes in the Controller for injectionFragment or Compose as View and ViewModel
RouteControllerVM. VM means ViewModelFragment or Compose as View and ViewModel and Dagger injection
RouteControllerVMC
By default this class should be abstract because all its method generated by the framework. You can override its if you need to do some extra action, for example add something to the Bundle of the Fragment.
Examples:
Simple scheme

Example for Fragment
Example with no parameters to transfer
With parameters
Full explanation and examples you can find here
Example for Compose
Example with no parameters to transfer
With parameters
Full explanation and examples you can find here
Last updated
Was this helpful?