Closed devj3ns closed 2 months ago
Fixing in #417
The difference with the final String
is a Flutter style I've since abandoned. It's fun to type strongly, but it gets tedious and unnecessary when it's inferred
@devj3ns updated in brick_supabase: 0.1.1
and brick_supabase_generators: 0.1.1
@tshedor, thanks for the fix, unfortunately, there are some more issues with the adapter generation.
The name clash with the tableName
got fixed by #417, but other attributes like fieldsToSqliteColumns
still are generated twice, which results in the following runtime error:
lib/brick/adapters/user_adapter.g.dart:105:52: Error: 'fieldsToSqliteColumns' is already declared in this scope.
final Map<String, RuntimeSqliteColumnDefinition> fieldsToSqliteColumns = {
It looks like the Map containing the RuntimeSupabaseColumnDefinition
s has the wrong name, it should be:
final Map<String, RuntimeSupabaseColumnDefinition> fieldsToSupabaseColumns = {
'id': const RuntimeSupabaseColumnDefinition(
...
instead of
final Map<String, RuntimeSqliteColumnDefinition> fieldsToSqliteColumns = {
'id': const RuntimeSupabaseColumnDefinition(
...
Moreover, I just saw that the onConflict
is missing its parenthesis:
@override
final onConflict = project_id;
And it is missing for adapters where its not defined in the SupabaseSerializable
on the model annotation:
lib/brick/adapters/customer_adapter.g.dart:102:7: Error: The non-abstract class 'CustomerAdapter' is missing implementations for these members:
- SupabaseAdapter.onConflict
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
I will try to create a PR which fixes this.
@devj3ns Fixed and published
@tshedor You are too fast :D
I found one more problem with the onConflict
(see edited comment above)
And the code $UserFromSupabase
and $UserToSupabase
is missing the ID which uses my custom UUID
OfflineFirstSerdes
. I will provide more details in the hour (have to leave shortly).
@devj3ns Fixed and published the fix for onConflict
. I've got to get to bed. Appreciate your help, reporting, and patience.
I close this issue, as the naming conflict is resolved by https://github.com/GetDutchie/brick/pull/417 and https://github.com/GetDutchie/brick/pull/420
The onConflict
problem is resolved by https://github.com/GetDutchie/brick/pull/422
The Serdes problem is resolved by https://github.com/GetDutchie/brick/pull/423
When running
dart run build_runner build
, the fields inside the generatedOfflineFirstWithSupabaseAdapter
are created twice, which results in the following error when running the app:As seen in the full code below, the fields like
tableName
,defaultToNull
,fieldsToSqliteColumns
(...) are defined twice. Interesting is that they are not the same (e.g.final tableName = 'user';
andfinal String tableName = 'User';
).Full code of the OfflineFirstWithSupabaseAdapter
```dart /// Construct a [User] class UserAdapter extends OfflineFirstWithSupabaseAdapter