AuthFlowBuilder<T extends AuthController> class
A widget that is used to wire up the AuthFlows with the widget tree.
Could be used to build a custom UI and facilitate the built-in functionality of the all available AuthFlows:
An example of how to build a custom email sign up form using AuthFlowBuilder:
final emailCtrl = TextEditingController();
final passwordCtrl = TextEditingController();
AuthFlowBuilder<EmailAuthController>(
auth: fba.FirebaseAuth.instance,
action: AuthAction.signUp,
listener: (oldState, newState, ctrl) {
if (newState is UserCreated) {
Navigator.of(context).pushReplacementNamed('/profile');
}
},
builder: (context, state, ctrl, child) {
if (state is AwaitingEmailAndPassword) {
return Column(
children: [
TextField(
decoration: InputDecoration(labelText: 'Email'),
controller: emailCtrl,
),
TextField(
decoration: InputDecoration(labelText: 'Password'),
controller: passwordCtrl,
),
OutlinedButton(
child: Text('Sign Up'),
onPressed: () {
ctrl.setEmailAndPassword(emailCtrl.text, passwordCtrl.text);
}
),
]
);
} else if (state is SigningIn) {
return Center(child: CircularProgressIndicator());
} else if (state is AuthFailed) {
return ErrorText(exception: state.exception);
}
}
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AuthFlowBuilder
Constructors
-
AuthFlowBuilder({Key? key, Object? flowKey, AuthAction? action, AuthFlowBuilderCallback<
T> ? builder, dynamic onComplete(AuthCredential credential)?, Widget? child, StateTransitionListener<T> ? listener, AuthProvider<AuthListener, AuthCredential> ? provider, FirebaseAuth? auth, AuthFlow<AuthProvider< ? flow})AuthListener, AuthCredential> > -
A widget that is used to wire up the AuthFlows with the widget tree.
const
Properties
- action → AuthAction?
-
An authentication action to perform.
final
- auth → FirebaseAuth?
-
The
FirebaseAuth
instance used to perform authentication against. By default,FirebaseAuth.instance
is used.final -
builder
→ AuthFlowBuilderCallback<
T> ? -
A callback that is being called every time the AuthFlow changes it's
state. Returned widget is rendered as a child of AuthFlowBuilder.
final
- child → Widget?
-
A pre-built child that will be provided as an argument of the builder.
final
-
flow
→ AuthFlow<
AuthProvider< ?AuthListener, AuthCredential> > -
An optional instance of the AuthFlow.
Should be rarely provided, as the AuthFlow is created automatically,
based on provider.
final
- flowKey → Object?
-
A unique object that is used as a key for an AuthFlow.
Could be used to obtain a controller via getController or
to read a current state using getState.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
listener
→ StateTransitionListener<
T> ? -
A callback that is being called when AuthFlow changes it's state.
final
- onComplete → (dynamic Function(AuthCredential credential)?)
-
A callback that is being called when the auth flow completes.
final
-
provider
→ AuthProvider<
AuthListener, AuthCredential> ? -
An optional instance of the AuthProvider that should be used to
authenticate. If not provided, a default instance of the AuthProvider
will be created. A type of provider is resolved by the type of the
AuthController provided to the AuthFlowBuilder.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _AuthFlowBuilderState< AuthController> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
getController<
T extends AuthController> (Object flowKey) → T? -
Resolves an AuthController by the
flowKey
. -
getState(
Object flowKey) → AuthState? -
Returns a current AuthState of the AuthFlow given the
flowKey
.