AuthState class abstract

An abstract class for all auth states. AuthState transitions could be captured with an AuthStateChangeAction:

SignInScreen(
  actions: [
    AuthStateChangeAction<SignedIn>((context, state) {
      print(state.user!.displayName);
      print(state.user!.isEmailVerified);
    }),
  ],
);

You could also subscribe your widget to auth state transitions with AuthState.of:

AuthFlowBuilder<EmailAuthController>(
  child: MyCustomWidget(),
);

class MyCustomWidget extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
   final state = AuthState.of(context);

   if (state is AwaitingEmailAndPassword) {
     return EmailForm();
   } else if (state is AuthFailed) {
     return ErrorText(state);
   } else if (state is SignedIn) {
     return Text(state.user!.displayName);
   } else {
     return Text("Unknown state ${state.runtimeType}");
   }
 }
}
Implementers

Constructors

AuthState()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

maybeOf(BuildContext context) AuthState?
Returns current AuthState of the auth flow. Could return null if no AuthFlowBuilder was found up the widget tree.
of(BuildContext context) AuthState
Returns current AuthState of the auth flow. Should be used only inside the widget that has an AuthFlowBuilder as an ancestor. Use maybeOf if there is a chance that the widget is used without AuthFlowBuilder as an ancestor.