brick_supabase 0.0.1 copy "brick_supabase: ^0.0.1" to clipboard
brick_supabase: ^0.0.1 copied to clipboard

Supabase connector for Brick, a data persistence library. Includes annotations, adapter, model, and provider.

brick_supabase workflow

Supabase Provider #

Connecting Brick with Supabase.

Models #

@SupabaseSerializable(tableName:) #

The Supabase table name must be specified to connect from, upsert and delete invocations:

@SupabaseSerializable(tableName: 'users')
class User
copied to clipboard

Fields #

@Supabase(unique:) #

Connect Supabase's primary key (or any other index) to your application code. This is useful for upsert and delete logic when mutating instances.

@Supabase(unique: true, name: 'id')
final int supabaseId;
copied to clipboard

@Supabase(enumAsString:) #

Brick by default assumes enums from a REST API will be delivered as integers matching the index in the Flutter app. However, if your API delivers strings instead, the field can be easily annotated without writing a custom generator.

Given the API:

{ "user": { "hats": ["bowler", "birthday"] } }
copied to clipboard

Simply convert hats into a Dart enum:

enum Hat { baseball, bowler, birthday }

...

@Supabase(enumAsString: true)
final List<Hat> hats;
copied to clipboard

@Supabase(name:) #

REST keys can be renamed per field. This will override the default set by SupabaseSerializable#fieldRename.

@Supabase(
  name: "full_name"  // "full_name" is used in from and to requests to REST instead of "last_name"
)
final String lastName;
copied to clipboard

@Supabase(ignoreFrom:) and @Supabase(ignoreTo:) #

When true, the field will be ignored by the (de)serializing function in the adapter.

Unsupported Field Types #

The following are not serialized to REST. However, unsupported types can still be accessed in the model as non-final fields.

  • Nested List<> e.g. <List<List<int>>>
  • Many-to-many associations
10
likes
0
points
2.23k
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.10 - 2025.03.25

Supabase connector for Brick, a data persistence library. Includes annotations, adapter, model, and provider.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

brick_core, brick_supabase_abstract, logging, meta, supabase_flutter

More

Packages that depend on brick_supabase