teller / com.levibostian.teller.cachestate / LocalDataState

LocalDataState

data class LocalDataState<CACHE : Any>

Local data (data obtained from the user or device, no network fetch call) in apps are in 1 of 2 different types of state:

  1. It is empty.
  2. It is not empty.

This class takes in a type of cacheData to keep state on via generic CACHE and it maintains the state of that cacheData. It gives you a snapshot of the state of your local data at any given time.

This class is used in companion with LocalRepository and LocalDataStateCompoundBehaviorSubject to maintain the state of cacheData to deliver to someone observing.

Properties

cacheData

val cacheData: CACHE?

isEmpty

val isEmpty: Boolean

Functions

deliverState

fun deliverState(listener: LocalDataStateListener<CACHE>): Unit

This is usually used in the UI of an app to display cacheData to a user.