firebase_auth_helper 0.0.4 copy "firebase_auth_helper: ^0.0.4" to clipboard
firebase_auth_helper: ^0.0.4 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 occurred: $error"));
2
likes
0
pub points
56%
popularity

Publisher

unverified uploader

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