Alexander Maryanovsky
05/22/2022, 3:38 PMAlexander Maryanovsky
05/22/2022, 3:39 PMYoussef Shoaib [MOD]
05/22/2022, 3:41 PMAlexander Maryanovsky
05/22/2022, 3:53 PMAlexander Maryanovsky
05/23/2022, 6:22 AMinline fun <reified T, R> combineFlows(
properties: Iterable<Flow<T>>,
crossinline transform: (Array<T>) -> R
): Flow<R> {
return combine(properties, transform)
}
val sumFlow: Flow<Int> = combineFlows(listOf<StateFlow<Int>>(), Array<Int>::sum)
Alexander Maryanovsky
05/23/2022, 6:41 AMinline fun foo(crossinline func: suspend () -> Int) = runBlocking { func() }
inline fun foobar(crossinline func: () -> Int) = foo(func)
val x = foobar{ 5 }
It’s passing a non-suspend function as a suspend function to an inline function.