SupportCoreDataSource

A data source that depends on kotlinx.coroutines.flow.Flow to publish results.

Since

v1.1.0

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val loadState: Flow<LoadState>

Observable for network state during requests that the UI can monitor and act based on state changes

Link copied to clipboard
open override val requestHelper: RequestHelper

Request helper that controls the flow of requests to the implementing data source to avoid multiple requests of the same type before others are completed for this instance

Functions

Link copied to clipboard
abstract suspend fun clearDataSource(context: CoroutineDispatcher)

Clears data sources (databases, preferences, e.t.c)

Link copied to clipboard
infix fun <T> IDataSource.create(model: Flow<T>): DataState<T>

Helper for creating a user interface state using a data source

Link copied to clipboard
open suspend override fun invalidate()

Invokes clearDataSource and should invoke network refresh or reload

Link copied to clipboard
open suspend override fun refresh()

Invalidate data source and, re-run the last successful or last failed request if applicable

Link copied to clipboard
open suspend override fun retryFailed()

Retries the last executed request, may also be called in refresh