Skip to content

Commit

Permalink
fix: re-initialize client
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 committed Jun 9, 2022
1 parent e3f07a5 commit e855eb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/src/supabase.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/foundation.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 @@ -71,7 +70,7 @@ class Supabase {
/// The supabase client for this instance
///
/// Throws an error if [Supabase.initialize] was not called.
late final SupabaseClient client;
late SupabaseClient client;
bool _debugEnable = false;

/// Dispose the instance to free up resources.
Expand Down
9 changes: 8 additions & 1 deletion test/supabase_flutter_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter_test/flutter_test.dart';

import 'package:supabase_flutter/supabase_flutter.dart';

import 'widget_test_stubs.dart';
Expand All @@ -22,6 +21,14 @@ void main() {
expect(client, isNotNull);
});

test('can re-initialize client', () async {
final client = Supabase.instance.client;
Supabase.instance.dispose();
final newClient =
Supabase.initialize(url: supabaseUrl, anonKey: supabaseKey);
expect(client, isNot(newClient));
});

test('can parse deeplink', () async {
final uri = Uri.parse(
"io.supabase.flutterdemo://login-callback#access_token=aaa&expires_in=3600&refresh_token=bbb&token_type=bearer&type=recovery",
Expand Down

0 comments on commit e855eb5

Please sign in to comment.