Czar
03/09/2020, 3:16 PMstreetsofboston
03/09/2020, 3:19 PMflow.withIndex().toList().last()
?streetsofboston
03/09/2020, 3:24 PMsuspend fun <T> Flow<T>.lastWithIndex(): Pair<Int, T>? {
var index = -1
var result: T?
collect { result = it; index++ }
return result?.let { index to it }
}