Member-only story
Compose Destinations — Navigation Library
How to convert your Jetpack Compose navigation app to use Compose Destinations Library to get rid of boilerplate code?
3 min readMay 21, 2022
This is part of the Jetpack Compose navigation series:
- Part 1 — Simple Jetpack Compose Navigation Example
- Part 2 — Compose Destinations — Navigation Library
- Part 3 — How to Add Bottom Navigation in Jetpack Compose?
- Part 4 — How to Add Navigation Drawer in Jetpack Compose?
- Part 5 — How to Add Deep Links in Jetpack Compose?
In my previous post, I build a very simple Jetpack Compose Navigation and use the NavRoute sealed class to avoid hard coding strings in multiple places.
However, a better solution may be just using this awesome Compose Destinations library! Let’s see how we can convert this app to use this library.
Setup build.gradle (module level)
1. Add KSP Plugin
Add com.google.devtools.ksp
plugin
plugins {
...
id 'com.google.devtools.ksp' version '1.6.10-1.0.2'
}