tursunov abdulbois
10/25/2021, 11:02 AMJoffrey
10/25/2021, 11:06 AMcollect
it. Nothing really happens when creating a Flow
(so calling a function that returns a Flow
often does nothing in itself). In this case, there is no real reason to make a function suspend (actually a good rule of thumb is to avoid marking a function suspend
if the compiler doesn't force you).
Sometimes, some functions can do some suspending stuff that starts something hot before returning a flow. But this is less common. This can be the case for instance if a function needs to start a subscription to something right away, and provide a guarantee to the caller that when the function returns, the subscription has happened, so they can do stuff after the subscription, but before collecting the flow.Adam Powell
10/25/2021, 1:45 PMMarcelo Hernandez
10/25/2021, 7:48 PMMarcelo Hernandez
10/25/2021, 7:52 PM