SafeArgs is a gradle plugin that allows you to Pass data to destination UI components. It generates simple object and builder classes for type-safe navigation and access to any associated arguments. Safe Args is strongly recommended for navigating and passing data because it ensures type-safety. A sample video is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the **Kotlin **language.

Step 1: Create a new project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Kotlin as the programming language.

Step 2: Add dependency

Inside build.gradle (project) add the following code under dependencies.

 dependencies {

    classpath “androidx.navigation:navigation-safe-args-gradle-plugin:2.3.2”


Inside build.gradle (app) add the following code and click Sync now

plugins {

   id ‘’

   id ‘kotlin-android’

   id ‘kotlin-android-extensions’

   id “androidx.navigation.safeargs.kotlin”


#android #kotlin

How to Pass Data to Destination using Safe Args in Android?
1.40 GEEK