Any idea why I didn't get a compile error there? T...
# coroutines
a
Any idea why I didn't get a compile error there? The
fetchSaleWithPhotosById
returns a
Flow<SaleEntity?>
instead of a List, however it still compiles.
Copy code
override fun read(key: SalesRequestKey): Flow<List<Sale>> = flow {
        when (key) {
            SalesRequestKey.AllSales -> emitAll(
                salesLocalDataSource.fetchAllSales()
                    .map { saleEntities -> saleEntities.map(saleEntityToDomainSaleEntityMapper) }
            )
            is SalesRequestKey.SingleSaleRequest -> emitAll(
                salesLocalDataSource.fetchSaleWithPhotosById(
                    key.saleId
                ).filterNotNull()
                    .map { saleEntity -> saleEntityToDomainSaleEntityMapper.invoke(saleEntity) }
            )
    }
m
Does the
saleEntityToDomainSaleEntityMapper.invoke
return
List<Sale>
?
a
Nope, that's the signature in the ctor
Copy code
private val saleEntityToDomainSaleEntityMapper:
Mapper<@JvmSuppressWildcards SaleEntity, @JvmSuppressWildcards Sale>