0Pricing
Kotlin Multiplatform Academy · Aula

Passe argumentos e links profundos

Transfira dados entre destinos com segurança

Passe argumentos e links profundos é uma aula grátis de Kotlin Multiplatform Academy no CoddyKit. Esta é a aula 2 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Kotlin Multiplatform Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Kotlin Multiplatform Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

Screens Need Data

A details screen has to know which item to show. Arguments are how one screen tells the next exactly what to display. 📦

Put the Value in the Route

You declare a placeholder right inside the route string. Curly braces mark where a value will be slotted in.

composable("details/{itemId}") { entry ->
    DetailsScreen(entry)
}

Read the Argument

Inside the destination you pull the value from the back stack entry. It arrives as a string you can use right away.

val itemId = entry.arguments?.getString("itemId")

Pass a Value When Navigating

To send data you simply build the real route with your value inside it, then navigate to that string.

navController.navigate("details/42")

Type-Safe Arguments

You can declare an argument as an Int instead of a string, so the framework parses and validates it for you.

composable(
    "details/{itemId}",
    arguments = listOf(navArgument("itemId") { type = NavType.IntType })
) { /* ... */ }

Optional Query Arguments

Some values are optional, like a search filter. You add them as query parameters after a question mark in the route.

navController.navigate("search?query=kotlin")

What Is a Deep Link

A deep link is a URL that opens a specific screen directly, even from outside the app. It maps a link to a route.

Register a Deep Link

You attach a deepLink pattern to a destination. When that URL arrives, navigation jumps straight to this screen.

composable(
    "details/{itemId}",
    deepLinks = listOf(navDeepLink { uriPattern = "myapp://details/{itemId}" })
) { /* ... */ }

Deep Links Carry Arguments Too

The same placeholders work in a deep link URL. The itemId from the link lands in your back stack entry like any argument.

Platforms Wire Links Differently

Android and iOS each register your URL scheme in their own config, but both then hand the link to the shared graph. 🔗

Keep Arguments Small

Pass an id, not a whole object. Let the destination load its own data from the id, so routes stay tiny and reliable.

Quick Check

How should you typically send a complex object to the next screen?

Recap: Data and Direct Links

You sent arguments through routes, read them on the next screen, and mapped a deep link URL straight to a destination. 🎯

Perguntas Frequentes

A aula “Passe argumentos e links profundos” é grátis?

Sim — o texto completo de “Passe argumentos e links profundos” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Kotlin Multiplatform Academy, atualize para CoddyKit PRO. O curso de Kotlin Multiplatform Academy inclui 4 aulas no total.

O que vou aprender em “Passe argumentos e links profundos”?

Transfira dados entre destinos com segurança Você pratica Kotlin Multiplatform Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Kotlin Multiplatform Academy?

Nenhuma experiência prévia é necessária. Kotlin Multiplatform Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 2 de 4.

Quanto tempo leva a aula “Passe argumentos e links profundos”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Kotlin Multiplatform Academy?

Sim. Cada aula de Kotlin Multiplatform Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Navegue entre telas compartilhadas
  2. Passe argumentos e links profundos
  3. Imagens, fontes e strings compartilhadas
  4. Localize textos da interface compartilhada
← Voltar para Kotlin Multiplatform Academy