BloomSupabaseTableRepository<T> class
Strongly-typed CRUD repository adapter for Supabase REST tables.
Implements BloomCrudRepository to perform queries, inserts, updates, and deletes against Supabase PostgREST tables.
Example:
final todoRepo = BloomSupabaseTableRepository<Todo>(
tableName: 'todos',
supabaseUrl: 'https://xyz.supabase.co',
supabaseAnonKey: 'anon-key',
fromJson: Todo.fromJson,
toJson: (t) => t.toJson(),
);
final todos = await todoRepo.findAll();
- Implemented types
Constructors
-
BloomSupabaseTableRepository({required String tableName, required String supabaseUrl, required String supabaseAnonKey, required T fromJson(Map<
String, dynamic> json), required Map<String, dynamic> toJson(T item), String? authTokenProvider()?, String? bearerToken}) -
Creates a BloomSupabaseTableRepository targeting
tableName.
Properties
-
fromJson
→ T Function(Map<
String, dynamic> json) -
Deserializer function converting Supabase row JSON maps to
T.final - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supabaseAnonKey → String
-
Supabase anonymous API key.
final
- supabaseUrl → String
-
Supabase project URL.
final
- tableName → String
-
Target Supabase table name.
final
-
toJson
→ Map<
String, dynamic> Function(T item) -
Serializer function converting
Tentity instances to JSON maps.final
Methods
-
create(
T item) → Future< T> -
Creates and stores a new entity
item.override -
delete(
String 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(
String 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(
String id, T item) → Future< T> -
Updates an existing entity
itemidentified byid.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited