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
-
- BloomReadOnlyRepository<
T, ID> - BloomWriteRepository<
T, ID>
- BloomReadOnlyRepository<
- Implementers
Constructors
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. Returnstrueif 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
Tmatchingid, ornullif 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
itemidentified byid.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited