Is it weird to have a non-suspending function that...
# coroutines
t
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
This is what
Flow.stateIn
does
j
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
Agreed it’s weird, because this suggests something that could outlive the flow collection Otherwise a scope limited to flow collector would look like
Copy code
flow { 
  coroutineScope {
  }
}
Or
channelFlow
👍 3
💯 1