-
Notifications
You must be signed in to change notification settings - Fork 52
Description
Hello, i am currently using brick with Supabase, but i am not yet using the offline first arquitecture (that's for the future me)
For this as the docs says i am using the SingleProviderRepository like this:
class Repository<TModel extends SupabaseModel> extends SingleProviderRepository<TModel> {
Repository._privateConstructor(super.supabaseProvider);
SupabaseClient get supabaseClient => Supabase.instance.client;
static Future<void> init() async {
await Supabase.initialize(
url: 'my url obviously',
anonKey: 'the key to other project obviously',
postgrestOptions: const PostgrestClientOptions(schema: 'api'),
storageOptions: const StorageClientOptions(retryAttempts: 1),
);
repository = Repository._privateConstructor(
SupabaseProvider(
Supabase.instance.client,
modelDictionary: supabaseModelDictionary,
),
);
await repository.initialize();
}
}And i have two problems, first, when running dart run build_runner build it does not generates adapters for my models and in brick.g.dart the supabaseMappings is empty
I annotated all my models like this:
import 'package:brick_supabase/brick_supabase.dart';
@SupabaseSerializable(tableName: 'activities_ratings')
class ActivityRating extends SupabaseModel {
ActivityRating({
required this.userId,
required this.activityId,
required this.comment,
required this.rating,
required this.createdAt,
required this.updatedAt,
});
final String userId;
final String activityId;
final String? comment;
final int rating;
//
final DateTime createdAt;
final DateTime updatedAt;
}
// this is in a file named: activity_rating.model.dartI followed this example, with the difference of the SupabaseSerializable annotation
My second problem is that i am missing a subscribe or subscribeToRealtime method, because SingleProviderRepository only implements delete, get, upsert methods
This is not an error as SingleProviderRepository is generic and subscribeToRealtime is something specific to Supabase, but i would be nice having a SupabaseRepository with a subscribe method