Skip to content

Rework the implementation - #4

Merged
phamhieu merged 8 commits into
supabase:mainfrom
bdlukaa:main
Jul 19, 2021
Merged

phamhieu merged 8 commits into
supabase:mainfrom
bdlukaa:main

Conversation

@bdlukaa

@bdlukaa bdlukaa commented Jul 18, 2021

Copy link
Copy Markdown
Collaborator

What kind of change does this PR introduce?

Rework the singleton

What is the current behavior?

To initialize it:

import 'package:supabase_flutter/supabase_flutter.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  Supabase(
    url: SUPABASE_URL,
    anonKey: SUPABASE_ANNON_KEY,
    authCallbackUrlHostname: 'login-callback', // optional
    debug: true // optional
  );

  runApp(MyApp());
}

To access the supabase instance:

import 'package:supabase_flutter/supabase_flutter.dart';

final response = await Supabase().client.auth.signIn(email: _email, password: _password);

What is the new behavior?

To initialize it:

import 'package:supabase_flutter/supabase_flutter.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  Supabase.initialize(
    url: SUPABASE_URL,
    anonKey: SUPABASE_ANNON_KEY,
    authCallbackUrlHostname: 'login-callback', // optional
    debug: true // optional
  );

  runApp(MyApp());
}

To access the supabase instance:

import 'package:supabase_flutter/supabase_flutter.dart';

final response = await Supabase.instance.client.auth.signIn(email: _email, password: _password);

Additional context

This rework comes with the purpose of making the library more dev-friendly. The documentation of some methods were also updated

@phamhieu

Copy link
Copy Markdown
Member

Wow, that's fast. Great work! @bdlukaa. Thank you

Can you fix the 2 lint errors. I will merge the PR after that.

@bdlukaa

bdlukaa commented Jul 18, 2021

Copy link
Copy Markdown
Collaborator Author

@phamhieu done! Please test it before merging

@phamhieu

Copy link
Copy Markdown
Member

@bdlukaa can you fix the unit test

Screenshot 2021-07-19 at 6 57 14 AM

@bdlukaa

bdlukaa commented Jul 19, 2021

Copy link
Copy Markdown
Collaborator Author

@phamhieu Done! All tests passing locally for me

✓ can access Supabase singleton
✓ can parse deeplink
✓ can parse flutter web redirect link
✓ can parse flutter web custom page redirect link

@phamhieu
phamhieu merged commit 1769faa into supabase:main Jul 19, 2021
jpohhhh added a commit to Telosnex/supabase-flutter that referenced this pull request Apr 19, 2026
fix/disconnect-leak-reconnect-timer     Finding #1 (UserDisconnectBug + ReconnectLeak)
fix/stale-pending-heartbeat-ref         Finding supabase#4 (StaleHeartbeat)
fix/connect-sync-transport-throw        Finding supabase#3 (SyncTransportThrow)

Each has a Dart regression test that was verified red on upstream/main
before the fix was applied.
jpohhhh added a commit to Telosnex/supabase-flutter that referenced this pull request Apr 21, 2026
fix/disconnect-leak-reconnect-timer     Finding #1 (UserDisconnectBug + ReconnectLeak)
fix/stale-pending-heartbeat-ref         Finding supabase#4 (StaleHeartbeat)
fix/connect-sync-transport-throw        Finding supabase#3 (SyncTransportThrow)

Each has a Dart regression test that was verified red on upstream/main
before the fix was applied.
jpohhhh added a commit to Telosnex/supabase-flutter that referenced this pull request Aug 18, 2026
fix/disconnect-leak-reconnect-timer     Finding #1 (UserDisconnectBug + ReconnectLeak)
fix/stale-pending-heartbeat-ref         Finding supabase#4 (StaleHeartbeat)
fix/connect-sync-transport-throw        Finding supabase#3 (SyncTransportThrow)

Each has a Dart regression test that was verified red on upstream/main
before the fix was applied.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants