commonMain.com.daftmobile.efekt.data.DataSource.kt Maven / Gradle / Ivy
package com.daftmobile.efekt.data
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.FlowCollector
import kotlinx.coroutines.flow.flow
public fun interface DataSource {
public fun call(request: Request): Flow
}
public fun dataSourceFlow(block: suspend FlowCollector.(Req) -> Unit): DataSource {
return DataSource { request ->
flow { block(request) }
}
}
public fun dataSourceOf(vararg values: Res): DataSource = dataSourceFlow {
values.forEach { emit(it) }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy