firebase_auth_helper 0.0.1 copy "firebase_auth_helper: ^0.0.1" to clipboard
firebase_auth_helper: ^0.0.1 copied to clipboard

outdated

Firebase Auth Helper. Provides a AuthProvider interface and FirebaseAuth implementation of it.

An AuthProvider interface with FirebaseAuth implementation

Usage #


final AuthProvider authProvider = FirebaseAuthProvider();
authProvider.signOut();

final signInResult = authProvider.emailPasswordSignIn(
    LoginCredentials("some@email.com", "secretPassword"));

final AuthUser currentUser = authProvider.currentAuthUser;
print
("Currently logged in as: 
${
currentUser.displayName}, 
${
currentUser.email}, 
${
currentUser.id}"
);

authProvider.authUserChanged.listen((
authUser) {
print("Auth user changed");
print("Is logged in: ${authUser.isLoggedIn}");
if (authUser.isLoggedIn) {
print("Currently logged in as: ${currentUser.displayName}, ${currentUser.email}, ${currentUser.id}");
}
});

Use the AuthStateWrapper to handle listening to the current auth state and display the correct page accordingly.


final AuthStateWrapper authStateWrapper = AuthStateWrapper(
    authProvider: authProvider,
    signedIn: (context) => HomePage(),
    notSignedIn: (context) => LoginPage(),
    loading: (context) => const CircularProgressIndicator(),
    error: (context, error) => Text("Error occured: $error"));
2
likes
0
points
109
downloads

Publisher

unverified uploader

Weekly Downloads

Firebase Auth Helper. Provides a AuthProvider interface and FirebaseAuth implementation of it.

License

unknown (license)

Dependencies

firebase_auth, firebase_core, flutter

More

Packages that depend on firebase_auth_helper