Adds notes on deprecated auth class on flutter v1 migration guide

This commit is contained in:
dshukertjr committed 2022-10-22 10:33:41 +09:00
1 parent 1a5c98907d
commit d7ed4b0edd
1 file changed
+44 -2
@@ -54,10 +54,50 @@ try {
</Tabs>
## Auth classes / methods
## Auth methods
### Usage of `AuthState` and `AuthRequiredState` classes
The signIn() method has been deprecated in favor of more explicit method signatures to help with type hinting. Previously it was difficult for developers to know what they were missing (e.g., a lot of developers didn't realize they could use passwordless magic links).
In v0, `AuthState` and `AuthRequiredState` were required to handle automatic token refresh and to listen to auth state change. In v1, `AuthState` and `AuthRequiredState` are deprecated, and token refresh will happen automatically just by initializing Supabase. [`onAuthStateChange`](/docs/reference/dart/upgrade-guide#listening-to-auth-state-change) can be used to action on auth state change.
<Tabs
groupId="version"
values={[
{label: 'Before', value: '0.x'},
{label: 'After', value: '1.x'},
]}>
<TabItem value="0.x">
```dart
await Supabase.initialize(
url: 'SUPABASE_URL',
anonKey: 'SUPABASE_ANON_KEY',
);
...
class AuthState<T extends StatefulWidget> extends SupabaseAuthState<T> {
...
}
...
class AuthRequiredState<T extends StatefulWidget> extends SupabaseAuthState<T> {
...
}
```
</TabItem>
<TabItem value="1.x">
```dart
await Supabase.initialize(
url: 'SUPABASE_URL',
anonKey: 'SUPABASE_ANON_KEY',
);
```
</TabItem>
</Tabs>
### Listening to auth state change
@@ -99,6 +139,8 @@ authSubscription.cancel();
### Sign in with email and password
The signIn() method has been deprecated in favor of more explicit method signatures to help with type hinting. Previously it was difficult for developers to know what they were missing (e.g., a lot of developers didn't realize they could use passwordless magic links).
<Tabs
groupId="version"
values={[