In a multiplatform project when I use this constru...
# squarelibraries
a
In a multiplatform project when I use this construct
Copy code
databaseQueries
            .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
Copy code
.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?