Slide 32
Slide 32 text
© 2019 Ubie, Inc.
Flowの仕組み
3
2
32
fun intStream(): Flow = flow {
repeat (10) {
delay(10)
emit(it)
}
}
public fun flow(
@BuilderInference block: suspend FlowCollector.() -> Unit
): Flow {
return object : Flow {
override suspend fun collect(collector: FlowCollector) {
SafeCollector(collector, coroutineContext).block()
}
}
}