CustomZipRepository<Data> class abstract

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.

Inheritance
Implementers

Constructors

CustomZipRepository({Duration? autoRefreshInterval, bool resolveOnCreate = true})
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.

Properties

autoRefreshInterval Duration?
The interval at which the repository will refresh itself. If null, the repository will not refresh itself. If not null, the repository will refresh itself every autoRefreshInterval.
finalinherited
currentState RepositoryState<Data>
Returns the current state of the repository.
no setterinherited
currentValue → Data?
Getter for the last value of the stream. Returns null if the stream is empty.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hydratationFiber → RepositoryFiber<Data?>
Fiber used to hydrate the repository.
finalinherited
key String
The key used to save the data in the cache. This key must be unique. If you have multiple repositories with the same key, the cache will be overwritten.
no setteroverride
name String
Repository name used in logs and debugging.
no setteroverride
refreshFiber → RepositoryFiber<Data>
The Fiber is used to avoid multiple refreshes at the same time.
finalinherited
repositories List<Repository>
A list of repositories that will be zipped.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<RepositoryState<Data>>
The stream of the repository. This stream will emit the data every time it changes. The data will be cached locally. The data will be refreshed every autoRefreshInterval. The data will be refreshed when refresh is called.
latefinalinherited
tag String?
The tag used to differ cache from same key repositories. It's commonly used to build the key property.
no setterinherited
timer Timer?
Internal timer used to refresh the repository.
getter/setter pairinherited

Methods

clear() Future<void>
Clears the cache and emits an empty state to the repository stream.
inherited
clearCache() Future<void>
Clears the cache.
inherited
currentValueOrResolve() Future<Data>
Get the current data of the repository if it's already resolved, otherwise resolve it. This method will not refresh the repository if it's already resolved.
inherited
dispose() → void
Disposes the repository. You should call this method when you're done using the repository. This method will cancel the timer and close the stream. You should not use the repository after calling this method.
inherited
emit({required Data data, RepositoryDatasource datasource = RepositoryDatasource.local}) Future<void>
Emits a new data to the repository.
inherited
fromJson(String json) → Data
Transforms the raw data from the remote source to the data that will be used in the stream.
override
hydrate({bool refreshAfter = true}) Future<Data?>
Gets the data from the cache, if it exists, and emits it to the stream.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() Future<Data>
Refreshes the repository from remote datasource.
override
resolve() Future<String>
Gets the data from the remote source and returns the raw data. The returned string will be saved in the cache and decoded using fromJson.
override
shouldRetry(Exception exception) FutureOr<bool>
Used to decide if the repository should retry after an error.
inherited
toString() String
A string representation of this object.
inherited
track() → void
Method used to add this repository to the pool. It's useful for debugging.
inherited
update(Data resolver(Data? data)) Future<void>
Updates the current data and refresh the repository. The resolver function takes the current data and returns the new data. The new data will be added to the stream and the repository will be refreshed. This method is useful if you want to use Optimistic UI. You can update the data to the repository and refresh in a row.
inherited
zipper(List values) → Data
The function that combines the data of the Repositorys into one.

Operators

operator ==(Object other) bool
The equality operator.
inherited