Created
October 10, 2025 22:25
-
-
Save Sottti/04e5db79381168345b1c2d952885c4e7 to your computer and use it in GitHub Desktop.
Revisions
-
Sottti created this gist
Oct 10, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ context(viewModel: ViewModel) public fun <T> Flow<T>.stateInWhileSubscribed( initialValue: T, ): StateFlow<T> = stateIn( scope = viewModel.viewModelScope, started = WhileSubscribed(stopTimeoutMillis = 5_000), initialValue = initialValue, )