Skip to content

Commit

Permalink
Merge pull request supabase#160 from Vinzent03/feat/http-client
Browse files Browse the repository at this point in the history
feat: custom http client
  • Loading branch information
dshukertjr committed Aug 3, 2022
2 parents b2a89a9 + b5abd06 commit 466f88c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.0.0-dev.2]

- feat: custom http client

## [1.0.0-dev.1]
- feat: add Mac OS and Windows support for deeplinks
- BREAKING: Remove SupabaseAuthRequiredState as well as overriding methods in SupabaseAuthState
Expand Down
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:lint/analysis_options.yaml
include: package:lints/recommended.yaml

linter:
rules:
Expand Down
11 changes: 9 additions & 2 deletions lib/src/supabase.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/foundation.dart';
import 'package:http/http.dart';
import 'package:supabase/supabase.dart';
import 'package:supabase_flutter/src/local_storage.dart';
import 'package:supabase_flutter/src/supabase_auth.dart';
Expand Down Expand Up @@ -43,12 +44,17 @@ class Supabase {
String? authCallbackUrlHostname,
bool? debug,
LocalStorage? localStorage,
Client? httpClient,
}) async {
assert(
!_instance._initialized,
'This instance is already initialized',
);
_instance._init(url, anonKey);
_instance._init(
url,
anonKey,
httpClient: httpClient,
);
_instance._debugEnable = debug ?? kDebugMode;
_instance.log('***** Supabase init completed $_instance');

Expand Down Expand Up @@ -76,10 +82,11 @@ class Supabase {
_initialized = false;
}

void _init(String supabaseUrl, String supabaseAnonKey) {
void _init(String supabaseUrl, String supabaseAnonKey, {Client? httpClient}) {
client = SupabaseClient(
supabaseUrl,
supabaseAnonKey,
httpClient: httpClient,
);
_initialized = true;
}
Expand Down
7 changes: 4 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: supabase_flutter
description: Flutter integration for Supabase. This package makes it simple for developers to build secure and scalable products.
version: 1.0.0-dev.1
version: 1.0.0-dev.2
homepage: 'https://supabase.io'
repository: 'https://github.com/supabase/supabase-flutter'

Expand All @@ -14,12 +14,13 @@ dependencies:
sdk: flutter
hive: ^2.2.1
hive_flutter: ^1.1.0
supabase: ^1.0.0-dev.1
http: ^0.13.4
supabase: ^1.0.0-dev.2
url_launcher: ^6.1.2

dev_dependencies:
flutter_test:
sdk: flutter
lint: ^1.5.2
lints: ^2.0.0

flutter:
2 changes: 1 addition & 1 deletion test/widget_test_stubs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class MockWidget extends StatefulWidget {
const MockWidget({Key? key}) : super(key: key);

@override
_MockWidgetState createState() => _MockWidgetState();
State<MockWidget> createState() => _MockWidgetState();
}

class _MockWidgetState extends State<MockWidget> {
Expand Down

0 comments on commit 466f88c

Please sign in to comment.