uhe
06/20/2019, 11:34 AMGlobalScope.launch {
flowOf(1,2,3,4,5)
.delayEach(500)
.map { it * it }
.collect { println(it) } // Type mismatch: inferred type is () -> ??? but FlowCollector<Int> was expected
}
thana
06/20/2019, 11:51 AMstreetsofboston
06/20/2019, 12:08 PMthana
06/20/2019, 12:18 PMVlad
06/20/2019, 12:36 PMuhe
06/20/2019, 1:08 PMcollect
extension, because apparently without the import it references Flow::collect
, resulting in the compile error.
That's... unfortunate. Thanks @Vladelizarov
06/20/2019, 1:32 PMuhe
06/20/2019, 1:38 PMcollect
method and selecting the extension function instead. It's just that the error was a bit misleading in the beginning, because a different collect
method is being referenced by default (the one with @InternalCoroutinesApi
in Flow
).