StorageRepository<Id, E extends Entity<Id>> class abstract

The StorageRepository is a repository that handles a generic storage as a data source.

This repository can save, read, delete, and update data regardless of where the data source is stored.

Saving and reading data to the data source is handled by the handler for the data source.

This repository can also read data from an external data source and cache it.

Implemented types
Mixed-in types

Constructors

StorageRepository({required IDataSourceHandler<Id, E> dataSourceHandler, required EntityStoreController controller})

Properties

controller EntityStoreController
final
dataSourceHandler IDataSourceHandler<Id, E>
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

count({CountOptions? options}) Future<int>
Counts the number of entities of type E.
override
delete(E entity, {DeleteOptions? options, TransactionContext? transaction}) Future<E>
Deletes an entity.
override
deleteById(Id id, {DeleteOptions? options, TransactionContext? transaction}) Future<Id>
Deletes an entity by its id.
override
findAll({FindAllOptions? options, TransactionContext? transaction}) Future<List<E>>
Finds all entities of type E.
override
findById(Id id, {FindByIdOptions? options, TransactionContext? transaction}) Future<E?>
Finds an entity by its id.
override
findOne({FindOneOptions? options, TransactionContext? transaction}) Future<E?>
Finds a single entity of type E.
override
fromJson(Map<String, dynamic> json) → E
inherited
idToString(Id id) String
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyDeleteComplete(Id id) → void
inherited
notifyEntityNotFound(Id id) → void
inherited
notifyGetComplete(E entity) → void
inherited
notifyListComplete(List<E> entities) → void
inherited
notifySaveComplete(E entity) → void
inherited
observeById(Id id, {ObserveByIdOptions? options}) Stream<E?>
Observes an entity by its id.
override
query() IRepositoryQuery<Id, E>
Creates a query object for querying entities of type E.
override
save(E entity, {SaveOptions? options, TransactionContext? transaction}) Future<E>
Saves an entity of type E.
override
toJson(E entity) Map<String, dynamic>
inherited
toString() String
A string representation of this object.
inherited
upsert(Id id, {required E? creater(), required E? updater(E prev), UpsertOptions? options}) Future<E?>
Upserts an entity by its id.
override

Operators

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