stock library

A Dart package for Async Data Loading and Caching,

A open source project made with ❤️ by Xmartlabs.

Classes

CachedSourceOfTruth<Key, T>
A memory cache implementation of a SourceOfTruth, which stores the latest value and notify new ones.
Fetcher<Key, T>
Fetcher is used by Stock to fetch network records of the type T for a given key of the type Key. The return type is Stream to allow for multiple results per request.
SourceOfTruth<Key, T>
SourceOfTruth, as its name implies, is the persistence API which Stock uses to serve values to the collectors. If provided, Stock will only return values received from SourceOfTruth back to the collectors.
Stock<Key, T>
A Stock is responsible for managing a particular data request.
StockRequest<Key>
Represents a single Stock request
StockResponse<Output>
Holder for responses from Stock.
StockResponseData<T>
Data dispatched by Stock
StockResponseError<T>
Error dispatched by a pipeline
StockResponseLoading<T>
Loading event dispatched by Stock to signal the Fetcher is currently running.
StockTypeMapper<Input, Output>
Converts the Input type to the Output and vice versa. Used to transform DB entity to network entity and vice versa.

Enums

ResponseOrigin
Represents the origin for a StockResponse.

Extensions

SourceOfTruthExtensions on SourceOfTruth<Key, Input>
SourceOfTruth useful extensions.
StockResponseExtensions on StockResponse<T>
Useful StockResponse extensions.

Exceptions / Errors

StockError
Used to notify unexpected errors