Deposit<E extends Entity, Id> class

A Deposit serves as a storage of entities with generic methods for managing entities.

It is designed to be subclassed so end-users can add their own business-specific methods to it.

Constructors

Deposit(String table, E builder(Map<String, dynamic>), {DepositAdapter<Id>? adapter, String primaryColumn = 'id'})
Construct a new Deposit that will retrieve it's entities from table.

Properties

builder → E Function(Map<String, dynamic>)
Entity builder.
final
hashCode int
The hash code for this object.
no setterinherited
primaryColumn String
The primary column of the Entity.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
table String
Reference to the internal data store for the _adapter.
final

Methods

add(E entity) Future<E>
Add an Entity in the data backend and return the newly stored Entity.
addAll(List<E> entities) Future<List<E>>
Add a list of entities in the data backend and return the newly stored entities.
by(String key, dynamic value) Future<List<E>>
Retrieve an Entity by given key matching the value.
exists(Id id) Future<bool>
Check if an Entity exists with the given Id.
getById(Id id) Future<E>
Retrieve an Entity by Id.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
page({int limit = 50, int skip = 0, OrderBy? orderBy}) Future<List<E>>
Return a list of paginated entities.
remove(E entity) Future<void>
Remove an Entity in the data backend.
removeAll(List<E> entities) Future<void>
Remove a list of entities in the data backend.
toString() String
A string representation of this object.
inherited
update(E entity) Future<E>
Update an Entity in the data backend and return the newly updated Entity.
updateAll(List<E> entities) Future<List<E>>
Update a list of entities in the data backend and return the newly updated entities.

Operators

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

Static Properties

defaultAdapter DepositAdapter
The default adapter for any Deposit to use when no adapter is given in the constructor.
latefinal