Created
October 10, 2025 22:25
-
-
Save Sottti/04e5db79381168345b1c2d952885c4e7 to your computer and use it in GitHub Desktop.
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 characters
context(viewModel: ViewModel) | |
public fun <T> Flow<T>.stateInWhileSubscribed( | |
initialValue: T, | |
): StateFlow<T> = stateIn( | |
scope = viewModel.viewModelScope, | |
started = WhileSubscribed(stopTimeoutMillis = 5_000), | |
initialValue = initialValue, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment