跳到正文
FunCoding

android-navigation-type-safe

Implement type-safe Jetpack Navigation Compose routes using Kotlin serialization. Use only when defining typed Compose destinations and arguments; defer XML navigation, deep links, animations, and generic auth or bottom-navigation work.

Star
598
许可证
MIT
最近提交
2026年12月2日

skills/android/android-navigation-type-safe/SKILL.md

在 GitHub 上查看

Android Navigation Standards

Priority: P0 (CRITICAL)

Implementation Guidelines

Type-Safe Navigation

  • Library: Navigation Compose 2.8.0+.
  • Routes: Use @Serializable objects/classes instead of String routes.
  • Arguments: No manual bundle parsing. Use .toRoute<T>().

Structure

  • Graphs: Split large apps into nested navigation graphs (navigation extension functions).
  • Hoisting: Hoist navigation events out of Screens. Composable screens should accept callbacks (onNavigateToX).

Anti-Patterns

  • No String Routes: Use @Serializable typed objects/classes for destinations.
  • No NavController in Composables: Hoist navigation events to screen-level callbacks.

References

Required route example

  • For a product detail argument, define @Serializable data class ProductDetail(val productId: Long) and navigate with the typed destination; retrieve it with toRoute<ProductDetail>().

相似的 Skill

blender-motion-state-inspection

AFaffaan-m/ECC315k近 7 天新增 4,381 个 star

官方

slack-gif-creator

ANanthropics/skills203k近 7 天新增 3,265 个 star

精选

algorithmic-art

用 p5.js 生成流场和粒子系统,通过种子随机性创作原创算法艺术。

ANanthropics/skills203k近 7 天新增 3,265 个 star

moneyprinterturbo-video

HAharry0703/MoneyPrinterTurbo147k近 7 天新增 1,608 个 star

thinking-out-loud

SHShubhamsaboo/awesome-llm-apps147k近 7 天新增 907 个 star

design-motion

GAgarrytan/gstack143k近 7 天新增 598 个 star