streetsofboston
05/06/2019, 2:58 PMFlow<T>
(successfully or with an error)?
The FlowCollector<T>
only has an emit
method.Dominaezzz
05/06/2019, 3:07 PMstreetsofboston
05/06/2019, 3:09 PMPaul Woitaschek
05/06/2019, 3:11 PMDominaezzz
05/06/2019, 3:11 PMflow { }
builder?jw
05/06/2019, 3:12 PMstreetsofboston
05/06/2019, 3:12 PMflow { ... }
lambda, it ends…streetsofboston
05/06/2019, 3:12 PMjw
05/06/2019, 3:12 PMstreetsofboston
05/06/2019, 3:13 PMFlowCollector
in a callback that repeatedly calls back?jw
05/06/2019, 3:14 PMjw
05/06/2019, 3:14 PMstreetsofboston
05/06/2019, 3:17 PMstreetsofboston
05/06/2019, 3:20 PMval gpsCoordsFlow: Flow<Pair<Double, Double>> = flow {
coroutineScope {
gpsManager.registerListener { coord ->
launch { emit(coord) }
}
suspendCoroutine<Nothing> { /* nothing */ }
}
(would need extra code to properly un-register the listener, etc.)jw
05/06/2019, 3:26 PMstreetsofboston
05/06/2019, 3:28 PM