AuthAdapter class abstract
Adapters to change the behavior of authentication on different platforms.
By passing an object inheriting from this in AuthAdapterScope, you can change the authentication for the entire app.
The actual authentication commands are performed using the Authentication class, but all internal implementation is done via this AuthAdapter.
プラットフォームごとの認証の振る舞いを変えるためのアダプター。
これを継承したオブジェクトをAuthAdapterScopeで渡すことによりアプリ全体の認証を変更することができます。
実際に認証コマンドを利用する際はAuthenticationのクラスを用いて行ないますが、内部実装はすべてこのAuthAdapter経由で行われます。
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return AuthAdapterScope(
adapter: const RuntimeAuthAdapter(),
child: MaterialApp(
home: const AuthPage(),
),
);
}
}
Constructors
-
AuthAdapter({List<
AuthActionQuery> authActions = const []}) -
Adapters to change the behavior of authentication on different platforms.
const
Properties
-
activeProviderIds
→ List<
String> ? -
Please return a list of IDs of authenticated providers.
no setter
-
authActions
→ List<
AuthActionQuery> -
Callbacks during authentication.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAnonymously → bool
-
For anonymous or guest authentication, return
true
.no setter - isSignedIn → bool
-
If you are signed in, return
true
.no setter - isVerified → bool
-
Return
true
if the registration has been authenticated.no setter - isWaitingConfirmation → bool
-
Return
true
if confirmSignIn or confirmChange is required.no setter - refreshToken → String?
-
Returns a refresh token used during sign-in and authentication.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userEmail → String?
-
Make sure to return the user's email address.
no setter
- userId → String?
-
When signing in, make sure to return the user ID on the authentication platform.
no setter
- userName → String?
-
Make sure to return the user name.
no setter
- userPhoneNumber → String?
-
Be sure to return the user's phone number.
no setter
- userPhotoURL → String?
-
Please make sure to return the URL of the user's icon image.
no setter
Methods
-
accessToken(
{bool forceRefresh = false}) → Future< AccessTokenValue?> - Returns the access token used during sign-in and authentication.
-
change(
{required ChangeAuthProvider provider, required VoidCallback onUserStateChanged}) → Future< void> - Used to change the registered information.
-
confirmChange(
{required ConfirmChangeAuthProvider provider, required VoidCallback onUserStateChanged}) → Future< void> - If you change with ChangePhoneNumberAuthProvider, for example, you need to check the authentication code you received from an email or SMS. In that case, use this method to finalize the change.
-
confirmSignIn(
{required ConfirmSignInAuthProvider provider, required VoidCallback onUserStateChanged}) → Future< void> - If you signIn with EmailLinkSignInAuthProvider or SmsSignInAuthProvider, you need to check the authentication code received from email or SMS. In that case, use this method to finalize the sign-in.
-
create(
{required CreateAuthProvider provider, required VoidCallback onUserStateChanged}) → Future< String?> -
Register users by passing a class inheriting from CreateAuthProvider in
provider
. -
delete(
{required VoidCallback onUserStateChanged}) → Future< void> - Deletes already registered users.
-
dispose(
) → void - Discard the adapter.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reauth(
{required ReAuthProvider provider}) → Future< bool> - If you are signed in, this is used to perform an authentication check just before changing information for authentication (e.g., email address).
-
register(
{required RegisterAuthProvider provider, required VoidCallback onUserStateChanged}) → Future< void> -
Register a user by passing a class inheriting from RegisterAuthProvider in
provider
. -
reset(
{required ResetAuthProvider provider}) → Future< void> - Used to reset the password.
-
signIn(
{required SignInAuthProvider provider, required VoidCallback onUserStateChanged}) → Future< void> -
Sign-in is performed by passing a class inheriting from SignInAuthProvider as
provider
. -
signOut(
{required VoidCallback onUserStateChanged}) → Future< void> - Sign out if you are already signed in.
-
toString(
) → String -
A string representation of this object.
inherited
-
tryRestoreAuth(
{bool retryWhenTimeout = false, required VoidCallback onUserStateChanged}) → Future< bool> - Running the application at startup will automatically re-authenticate the user.
-
verify(
{required VerifyAuthProvider provider, required VoidCallback onUserStateChanged}) → Future< void> - Used to prove possession of the e-mail address.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- primary → AuthAdapter
-
You can retrieve the AuthAdapter first given by AuthAdapterScope.
no setter