Arun Joseph
04/19/2023, 8:00 PMdatabaseQueries
.selectAllItems {
// mapper
}
.asFlow()
.mapToList()
.flowOn(dispatcher)
I find that mapToList
can be concurrently executed by flow collections, and causes android.database.sqlite.SQLiteBlobTooBigException
by with cursor filled to maximum. Is there any API option to prevent this? I changed the construct to
.asFlow()
.map { query ->
mutex.withLock {
withContext(dispatcher) {
query.executeAsList()
}
}
}
.flowOn(dispatcher)
and this fixes the exception. Is this the common way to fix such a problem?