Skip to content
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

Using withContext { } instead of Flow for long running task #2

Open
YogeshUmeshVaity opened this issue May 25, 2020 · 0 comments
Open

Comments

@YogeshUmeshVaity
Copy link

Hi, first, thanks for creating these examples. I have a few questions:

So, as we know, Flow is used for returning multiple asynchronously computed values. But here we are only doing a single task and returning a single value. Wouldn't it be more appropriate to use suspend function along with withContext { } instead of Flow for a single long running task?

I was wondering why have you used Flow? Does it offer any adavantage over withContext { } in this case?

In case, this example is only for demonstration purposes? Don't we need a more suitable example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant