Files
AndroidProject-Compose/app/src/main/java/com/joker/kit/navigation/RefreshResultKey.kt
2025-11-30 01:38:52 +08:00

24 lines
625 B
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.joker.kit.navigation
/**
* 通用的页面刷新结果 Key。
*
* 语义等价于以前的 "refresh" 布尔标记:
* - true 表示上一个页面需要刷新数据
* - false 或 null 表示不刷新
*
* 示例:
* ```kotlin
* // 子页面:操作成功后返回并通知上一个页面刷新
* popBackStackWithResult(RefreshResultKey, true)
*
* // 上一个页面ViewModel
* fun observeRefresh(backStackEntry: NavBackStackEntry?) {
* observeRefreshState(backStackEntry, RefreshResultKey)
* }
* ```
*
* @author Joker.X
*/
object RefreshResultKey : NavigationResultKey<Boolean>