https://kotlinlang.org logo
Title
u

user

07/25/2022, 7:41 AM
Will the operation of collect from Flow cost many system resources when I use Compose with Kotlin? The SoundViewModel is a ViewModel class, and val listSoundRecordState may be used by some modules in the App. In Code A, I invoke fun collectListSoundRecord() when I need to use the data listSoundRecordState. But fun collectListSoundRecord() may be launched again and again because of Jetpack Compose recomposition, I don't know if it will cost many system resources? In Code B, I launch private fun collectListSoundRecord() in init { }, collectListSoundRecord() will be launched only one time,...