Skip to content

Commit 9365fa2

Browse files
committed
be explicit with naming
1 parent ae9b8a0 commit 9365fa2

File tree

8 files changed

+16
-18
lines changed

8 files changed

+16
-18
lines changed

docs/offline_first/offline_first_with_supabase_repository.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class MyRepository extends OfflineFirstWithSupabaseRepository {
4040
4141
static void configure({
4242
required String supabaseUrl,
43-
required String anonKey,
43+
required String supabaseAnonKey,
4444
}) {
4545
// Convenience method `.clientQueue` makes creating the queue and client easy.
4646
final (client, queue) = OfflineFirstWithSupabaseRepository.clientQueue(
@@ -50,7 +50,7 @@ class MyRepository extends OfflineFirstWithSupabaseRepository {
5050
);
5151

5252
final provider = SupabaseProvider(
53-
SupabaseClient(supabaseUrl, anonKey, httpClient: client),
53+
SupabaseClient(supabaseUrl, supabaseAnonKey, httpClient: client),
5454
modelDictionary: supabaseModelDictionary,
5555
);
5656

example_supabase/lib/brick/repository.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Repository extends OfflineFirstWithRestRepository {
1414
'${SUPABASE_PROJECT_URL}/rest/v1',
1515
modelDictionary: restModelDictionary,
1616
client: SupabaseBrickClient(
17-
anonKey: SUPABASE_ANON_KEY,
17+
supabaseAnonKey: SUPABASE_ANON_KEY,
1818
),
1919
),
2020
sqliteProvider: SqliteProvider(

example_supabase/lib/brick/supabase_brick_client.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import 'package:supabase_flutter/supabase_flutter.dart';
55
/// Supabase REST-API.
66
class SupabaseBrickClient extends http.BaseClient {
77
SupabaseBrickClient({
8-
required this.anonKey,
8+
required this.supabaseAnonKey,
99
http.Client? innerClient,
1010
this.resourceName = 'dart.http',
1111
}) : _innerClient = innerClient ?? http.Client();
1212

1313
/// The anon key of the supabase project.
1414
///
1515
/// This is sent in the request headers as the `apikey` field.
16-
final String anonKey;
16+
final String supabaseAnonKey;
1717

1818
/// Populates APM's "RESOURCE" column. Defaults to `dart.http`.
1919
final String resourceName;
@@ -27,12 +27,11 @@ class SupabaseBrickClient extends http.BaseClient {
2727
@override
2828
Future<http.StreamedResponse> send(http.BaseRequest request) async {
2929
// The access token is automatically refreshed by the supabase client
30-
final accessToken =
31-
Supabase.instance.client.auth.currentSession?.accessToken;
30+
final accessToken = Supabase.instance.client.auth.currentSession?.accessToken;
3231

3332
request.headers.addAll({
3433
if (accessToken != null) 'Authorization': 'Bearer $accessToken',
35-
'apikey': anonKey,
34+
'apikey': supabaseAnonKey,
3635
'Content-Type': 'application/json; charset=utf-8',
3736
// In order to use the upsert method for updates, the following header
3837
// is needed for the REST API to work correctly.

example_supabase/lib/main.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:uuid/uuid.dart';
99
Future<void> main() async {
1010
await Supabase.initialize(
1111
url: SUPABASE_PROJECT_URL,
12-
anonKey: SUPABASE_ANON_KEY,
12+
supabaseAnonKey: SUPABASE_ANON_KEY,
1313
);
1414

1515
Repository.configure();
@@ -71,8 +71,7 @@ class MyHomePage extends StatelessWidget {
7171
? Center(child: Text('No customers found.'))
7272
: ListView.builder(
7373
itemCount: customers.length,
74-
itemBuilder: (context, index) =>
75-
CustomerListTile(customers[index]),
74+
itemBuilder: (context, index) => CustomerListTile(customers[index]),
7675
);
7776
} else if (snapshot.hasError) {
7877
return Center(child: Text('Error: ${snapshot.error}'));

packages/brick_offline_first_with_supabase/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MyRepository extends OfflineFirstWithSupabaseRepository {
2626
2727
static void configure({
2828
required String supabaseUrl,
29-
required String anonKey,
29+
required String supabaseAnonKey,
3030
}) {
3131
// Convenience method `.clientQueue` makes creating the queue and client easy.
3232
final (client, queue) = OfflineFirstWithSupabaseRepository.clientQueue(
@@ -36,7 +36,7 @@ class MyRepository extends OfflineFirstWithSupabaseRepository {
3636
);
3737
3838
final provider = SupabaseProvider(
39-
SupabaseClient(supabaseUrl, anonKey, httpClient: client),
39+
SupabaseClient(supabaseUrl, supabaseAnonKey, httpClient: client),
4040
modelDictionary: supabaseModelDictionary,
4141
);
4242

packages/brick_offline_first_with_supabase/example/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MyRepository extends OfflineFirstWithSupabaseRepository {
3030

3131
static void configure({
3232
required String supabaseUrl,
33-
required String anonKey,
33+
required String supabaseAnonKey,
3434
}) {
3535
final (client, queue) = OfflineFirstWithSupabaseRepository.clientQueue(
3636
// For Flutter, use import 'package:sqflite/sqflite.dart' show databaseFactory;
@@ -39,7 +39,7 @@ class MyRepository extends OfflineFirstWithSupabaseRepository {
3939
);
4040

4141
final provider = SupabaseProvider(
42-
SupabaseClient(supabaseUrl, anonKey, httpClient: client),
42+
SupabaseClient(supabaseUrl, supabaseAnonKey, httpClient: client),
4343
modelDictionary: supabaseModelDictionary,
4444
);
4545

packages/brick_offline_first_with_supabase/lib/src/offline_first_with_supabase_repository.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import 'package:sqflite_common/sqlite_api.dart' show DatabaseFactory;
2424
/// databaseFactory: databaseFactory
2525
/// );
2626
/// final provider = SupabaseProvider(
27-
/// SupabaseClient(supabaseUrl, anonKey, httpClient: client),
27+
/// SupabaseClient(supabaseUrl, supabaseAnonKey, httpClient: client),
2828
/// modelDictionary: supabaseModelDictionary,
2929
/// );
3030
///

packages/brick_supabase/example/example.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ class User extends SupabaseModel {
5959
}
6060

6161
class MyRepository extends SingleProviderRepository<SupabaseModel> {
62-
MyRepository(String apiUrl, String anonKey)
62+
MyRepository(String apiUrl, String supabaseAnonKey)
6363
: super(
6464
SupabaseProvider(
65-
SupabaseClient(apiUrl, anonKey),
65+
SupabaseClient(apiUrl, supabaseAnonKey),
6666
modelDictionary: dictionary,
6767
),
6868
);

0 commit comments

Comments
 (0)