I encountered a problem about kotlin Flow.When I copy the code from Official guide,the Android Studio prompts an error "No type arguments expected for class Flow".Does anyone know why? Thanks for answering .
fun simple(): Flow<Int> = flow {
for (i in 1..3) {
delay(100)
emit(i)
}
}
CodePudding user response:
Make sure you use import kotlinx.coroutines.flow.Flow
not java.util.concurrent.Flow
, it gives you this error because Java concurrent Flow class take 0 type arguments, but Coroutines Flow take one