Adam Hurwitz
1 min readOct 17, 2019

--

Implementing suspend for@Insert and @Update calls works as expected. However, suspend is not working for @Query calls that return a DataSource.Factory<Int, Content> in order to construct a PagedList. The issue has been outlined in this StackOverflow.

For example this works as expected.

@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertContentList(users: ArrayList<Content?>)

Using suspend for the DataSource.Factory<Int, Content> the app fails to build.

@Query("SELECT * FROM content WHERE timestamp >= :timeframe AND feedType = :feedType ORDER BY timestamp DESC")
suspend fun queryMainContentList(timeframe: Timestamp, feedType: FeedType): DataSource.Factory<Int, Content>

--

--

Adam Hurwitz
Adam Hurwitz

Written by Adam Hurwitz

An account about nothing | Researcher and product consultant

No responses yet