Is it weird to have a non-suspending function that takes a
CoroutineScope
and returns a
Flow
? e.g.,
Copy code
fun CoroutineScope.getMyStuffs(): Flow<MyStuff>
k
kevin.cianfarini
10/07/2023, 5:31 PM
This is what
Flow.stateIn
does
j
jw
10/07/2023, 5:44 PM
It's a little weird. What is the scope used for? Why can't you use a scope within the flow collection?
βπ» 1
βοΈ 4
p
Patrick Steiger
10/07/2023, 8:37 PM
Agreed itβs weird, because this suggests something that could outlive the flow collection
Otherwise a scope limited to flow collector would look like