我的问题是我们如何从构建的流对象中发出一个值,如下所示:
class Sample {
var flow: Flow<Object> = null
fun sendRequest(){
flow = flow{}
requestWrapper.flowResponse = flow
}
fun getResponse(){
// I want to emit data here with built flow object on
// requestWrapper like this
requestWrapper.flowResponse.emit()
}
}
Run Code Online (Sandbox Code Playgroud)
这个问题有什么可能的解决方案吗?
android kotlin kotlin-coroutines kotlin-flow kotlin-sharedflow