-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Kotlin Flow] Using "launchIn" instead of "collect" for collecting Flows in ViewModel #425
Comments
luongvo
added a commit
that referenced
this issue
Mar 10, 2023
luongvo
added a commit
that referenced
this issue
Mar 15, 2023
luongvo
added a commit
that referenced
this issue
Mar 15, 2023
luongvo
added a commit
that referenced
this issue
Mar 21, 2023
luongvo
added a commit
that referenced
this issue
Mar 21, 2023
luongvo
added a commit
that referenced
this issue
Mar 21, 2023
luongvo
added a commit
that referenced
this issue
Mar 22, 2023
luongvo
added a commit
that referenced
this issue
Mar 27, 2023
ryan-conway
added a commit
that referenced
this issue
Apr 10, 2023
…d-of-collect [#425] [Kotlin Flow] Using "launchIn" instead of "collect" for collecting Flows in ViewModel
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why
Using
launchIn
instead ofcollect
for collecting Flows in ViewModel is recommended way, because:collect()
will block the coroutine until the flow has finished emitting. This behavior is sometimes desired, but it’s not in most cases.launchIn
is less code to write, we don’t have to have indentations, and easier to understand.execute
operator in the BaseVIewModel.Sample implementation:
RFC discussion: #408
References:
Who Benefits?
Developers
The text was updated successfully, but these errors were encountered: