repository library

The all-in-one solution for fetching remote data from a REST API using the power of caching and auto refresh.

Classes

CustomHttpRepository<Data>
A CustomHttpRepository is a Repository that fetches data from an Http endpoint. It differs from HttpRepository in that it allows you to customize the request.
CustomZipRepository<Data>
A Repository that combines multiple Repositorys into one. It takes a list of data of each repository and returns a single zipped data. It is useful when you want to combine multiple repositories into one.
HiveRepositoryCacheStorage
A cache storage implementation that uses Hive.
HttpRepository<Data>
Exception thrown when the endpoint returns a unsuccessful status code.
HttpRepositoryHttpClient
A RepositoryHttpClient that uses http package.
Repository<Data>
A Repository is a class that holds data and provides a stream. It can be used to fetch data from a remote source, cache it, and provide a stream of that data.
RepositoryCacheStorage
An abstract storage to cache data from repositories. It is used by the Repository class and wraps an implementation of a cache storage.
RepositoryHttpClient
Abstract class for HTTP client to be used in http Repositories. You can use this class to create your own HTTP client, or just use the default one.
RepositoryHttpRequest
This is used by RepositoryHttpClient to make HTTP requests. You can use this class to create your own HTTP client, or just use the default one. But notice that Repositories will only use GET method.
RepositoryHttpResponse
A class that represents the response from a HTTP request.
RepositoryState<Data>
A generic class that holds a value of the current state of the repository.
RepositoryStateEmpty<Data>
A RepositoryState that indicates that the repository is loading data.
RepositoryStateReady<Data>
A RepositoryState that indicates that the repository has successfully loaded data.
ZipRepository<Data>
Creates a ZipRepository that combines multiple Repositorys into one. It takes a list of Repositorys and a zipper function. The zipper function takes a list of streams and returns a single stream. The zipper function is called every time one of the Repositorys emits a new value.

Enums

RepositoryDatasource
The source of the current data in the repository.

Mixins

PropagatingRepositoryMixin<Data>
A Repository that can be backpropagated to a remote source. It is useful when you want to save data to a remote source though a repository. For example, you can use this mixin to save data to a remote API when a user updates a profile.

Typedefs

BearerToken = String
A type alias for bearer token String. Notice that this is just the token, without the Bearer prefix.
TokenBuilder = Future<BearerToken?> Function()
A type alias for a function that returns a BearerToken.