-
Kotlin 如何預防 Launch 連發,搜尋任務

不管處理何種問題,我們都必須考慮是出於何種場景,就像是 使用者在 1 秒內點了 10 次。由於 launch 的天性是「射後不理 (fire-and-forget)」,你的 App 也會忠實地啟動 1…
-
Compose 三階段渲染管線

「想當年寫傳統 Android View,自訂元件最怕在 onMeasure 裡跟 MeasureSpec 大 […]
-
inline, noinline, crossinline:存在即合理

「Kotlin 編譯器團隊絕對不是吃飽太閒,才發明 inline、noinline、crossinline 這 […]
-
CreationExtras.inventoryApplication() 這有點跳

「看官方範例或 Codelab 時,很多人看到 CreationExtras.inventoryApplica […]
-
Communicate with fragments

請忘掉 getActivity() 或 findFragmentByTag()。 現代化的 Fragment 通訊,核心是「中介者模式」。你有兩種武器:ViewModel 和 Fragment Res…
-
kotlin init 前初始化屬性會發生啥事

在寫 Kotlin 時,我們常常會把變數宣告放在後面,或者在 init 裡做一堆初始化的事。 但很多人沒搞清楚 […]
-
@Immutable @Stable 如果 immutableList 內包含 list .這樣會造成 recompstion 嗎?

先說答案:會,而且這絕對是寫 Jetpack Compose 最容易被陰的坑。 很多人以為外層包了一層 Imm […]
-
Hilt 指南 組內分享

市場上已經很多依賴注入套件(dagger , koin)的選擇 ,還有很多文章介紹了,我會選擇 hilt 很單 […]
-
handle all repostiory operation that out of Composable/ViewModel scope

作法一:async + await(我要結果,但任務不能停) 這招的核心是「分離執行與等待的生命週期」。Rep […]
-
Difference between constructors and init in kotlin

原文 誰負責「定義」?誰負責「執行」? 在 Kotlin 中,Object 創建是個有順序的過程。constr […]