BloomCrudRepository<T, ID> class abstract

Generic CRUD repository interface for typed entities composing read and write contracts.

Example:

class TaskRepository extends BloomRepository
    implements BloomCrudRepository<Task, String> {
  @override
  Future<List<Task>> findAll() => http.get<List<Task>>('/tasks');
  @override
  Future<Task?> findById(String id) => http.get<Task?>('/tasks/$id');
  @override
  Future<Task> create(Task item) => http.post<Task>('/tasks', body: item.toMap());
  @override
  Future<Task> update(String id, Task item) => http.put<Task>('/tasks/$id', body: item.toMap());
  @override
  Future<bool> delete(String id) async {
    await http.delete<void>('/tasks/$id');
    return true;
  }
}
Implemented types
Implementers

Constructors

BloomCrudRepository()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

create(T item) Future<T>
Creates and stores a new entity item.
override
delete(ID id) Future<bool>
Deletes an entity identified by id. Returns true if deleted.
override
findAll() Future<List<T>>
Retrieves all records of entity type T.
override
findById(ID id) Future<T?>
Retrieves a single record of entity type T matching id, or null if not found.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
update(ID id, T item) Future<T>
Updates an existing entity item identified by id.
override

Operators

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