-
handle all repostiory operation that out of Composable/ViewModel scope
作法一:async + await(我要結果,但任務不能停) 這招的核心是「分離執行與等待的生命週期」。Rep…
-
Difference between constructors and init in kotlin

原文 誰負責「定義」?誰負責「執行」? 在 Kotlin 中,Object 創建是個有順序的過程。constr…
-
Jetpack Compose: 何時該用 derivedStateOf?

官方導讀 derivedStateOf 是一個效能優化工具,專門用來防止因「來源狀態」變化過於頻繁而導致的**…
-
viewModelScope vs rememberCoroutineScope 其實沒啥好 versus ,就是 SOC 職責分離

viewModelScope:與 ViewModel 的生命週期綁定,只能用在資料/邏輯層。 remember…
-
SupervisorJob 不就是 viewModelScope嗎?

Job 不僅僅是 launch 的回傳值,它是我們管理 Coroutine 的「遙控器」。 Job : Job…
-
fun GameScreen(gameViewModel: GameViewModel = GameViewModel()) 這樣寫有啥問題?

直接 new GameViewModel() Kotlin class GameViewModel : Vie…