Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework the implementation #4

Merged
merged 8 commits into from
Jul 19, 2021
Merged

Rework the implementation #4

merged 8 commits into from
Jul 19, 2021

Conversation

bdlukaa
Copy link
Collaborator

@bdlukaa bdlukaa commented Jul 18, 2021

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
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
Copy link
Collaborator Author

bdlukaa commented Jul 18, 2021

@phamhieu done! Please test it before merging

@phamhieu
Copy link
Member

@bdlukaa can you fix the unit test

Screenshot 2021-07-19 at 6 57 14 AM

@bdlukaa
Copy link
Collaborator Author

bdlukaa commented Jul 19, 2021

@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

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