Skip to content

Instantly share code, notes, and snippets.

@aleweichandt
Created Aug 17, 2021
Embed
What would you like to do?
Query migration example
class TodoRepository(
private val localSource: ITodoCache, // Cache injection
private val remoteSource: ITodoApi
) {
// new resource to query List<Todo>
private val todoResource: Resource<Unit, List<Todo>>
// migrate call to use resource
// before was like: remoteSource.getAllTodos()
suspend fun getAllTodos(force: Boolean): Flow<List<Todo>?> =
resourceGroup.query(Unit, force)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment