firebase_auth_router 1.0.3 copy "firebase_auth_router: ^1.0.3" to clipboard
firebase_auth_router: ^1.0.3 copied to clipboard

Navigate between unauthenticated and an authenticated screen easily with Firebase Auth.

Firebase Auth Router #

A Flutter widget that handles routing based on Firebase Authentication state. This package automatically navigates between pages based on the user's authentication status.

Demo: https://jake-mok-nelson.github.io/firebase_auth_router/

Features #

  • Automatic routing between authenticated and unauthenticated states
  • Customizable loading widget during authentication state changes
  • Simple integration with Firebase Auth

Installation #

Add this dependency to your pubspec.yaml:

dependencies:
  firebase_auth_router: ^1.0.3
copied to clipboard

Usage #

FirebaseAuthRouter(
  firebaseAuth: FirebaseAuth.instance,
  home: HomePage(),           // Shown when user is authenticated
  loginPage: LoginPage(),     // Shown when user is not authenticated
  loadingWidget: LoadingPage(), // Shown during authentication state changes
)
copied to clipboard

Example #

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: FirebaseAuthRouter(
        firebaseAuth: FirebaseAuth.instance,
        home: HomePage(),
        loginPage: LoginPage(),
        loadingWidget: LoadingPage(),
      ),
    );
  }
}
copied to clipboard

API Reference #

FirebaseAuthRouter #

A widget that manages routing based on Firebase Authentication state.

Properties

Property Type Description
firebaseAuth FirebaseAuth Instance of Firebase Authentication
home Widget Widget to display when user is authenticated
loginPage Widget Widget to display when user is not authenticated
loadingWidget Widget Widget to display during authentication state changes

Requirements #

  • Flutter SDK
  • Firebase Core
  • Firebase Auth

License #

MIT License

1
likes
160
points
50
downloads

Publisher

verified publisherjakenelson.cloud

Weekly Downloads

2024.09.11 - 2025.03.26

Navigate between unauthenticated and an authenticated screen easily with Firebase Auth.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

firebase_auth, firebase_core, flutter

More

Packages that depend on firebase_auth_router