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

A lightweight Firebase Authentication wrapper for Flutter. Simplify auth logic with a clean API supporting Email, Google, Apple, Facebook, X (Twitter), and Yahoo Sign-In.

TurboFireAuth 🚀 #

A Flutter package for easy and clean Firebase Authentication.
Simplify your auth logic with a clean, singleton-based approach supporting Email/Password and Google Sign-In out of the box.

Note: If your project is initialized with the FlutterFire CLI, providing FirebaseOptions to the initialize method is not required, as it will be handled by the system's default configuration.

pub package License: Apache 2.0


Features ✨ #

  • Clean Singleton API: Access everything via TurboFireAuth.instance.
  • Multiple Auth Providers: Supports Email/Password (Login & Register) and Google Sign-In.
  • Comprehensive Results: Instead of catching exceptions, handle specific LoginResult types.
  • User Management: Easy methods for password reset, profile updates, and current user retrieval.
  • Ready for Web & Mobile: Handles persistence and platform-specific logic internally.

Installation 📦 #

Add turbo_fireauth to your pubspec.yaml:

dependencies:
  turbo_fireauth: ^0.0.1

Then run:

flutter pub get

Usage 🛠️ #

1. Initialization #

Initialize the package in your main.dart before calling any auth methods.

import 'package:turbo_fireauth/turbo_fireauth.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  
  await TurboFireAuth.instance.initialize(
    // Optional: provide FirebaseOptions for manual initialization
    // If using FlutterFire CLI, this is handled automatically.
    // options: DefaultFirebaseOptions.currentPlatform,
    googleSigninConfig: GoogleSigninConfig(
      clientId: "YOUR_GOOGLE_CLIENT_ID",
    ),
  );
  
  runApp(MyApp());
}

2. Login / Register #

Email Login

final result = await TurboFireAuth.instance.login(
  EmailLogin("user@example.com", "password123"),
);

if (result is Success) {
  print("Welcome ${result.user.email}!");
} else if (result is WrongPasswordFailure) {
  print("Oops, wrong password.");
}

Google Sign-In

final result = await TurboFireAuth.instance.login(GoogleLogin());

3. User Actions #

// Logout
await TurboFireAuth.instance.logout();

// Get Current User
final user = await TurboFireAuth.instance.getCurrentUser();

// Reset Password
await TurboFireAuth.instance.sendPasswordResetEmail("user@example.com");

// Update Profile
await TurboFireAuth.instance.updateUserName("New Name");

Handling Results 🎯 #

TurboFireAuth returns a LoginResult for all login operations, making error handling predictable:

  • Success: Login successful, contains the User.
  • EmailAlreadyExistsFailure: Registration failed because email is in use.
  • WrongCredentials: Invalid email or password.
  • UserDisabledFailure: The user account has been disabled.
  • LoginCancelledFailure: User closed the login popup/modal.
  • And many more...

Contribution 🤝 #

Feel free to open issues or submit pull requests to help improve this package!

License 📄 #

This project is licensed under the Apache License 2.0.

0
likes
0
points
27
downloads

Publisher

verified publishersallmann.fr

Weekly Downloads

A lightweight Firebase Authentication wrapper for Flutter. Simplify auth logic with a clean API supporting Email, Google, Apple, Facebook, X (Twitter), and Yahoo Sign-In.

Repository (GitHub)
View/report issues

Topics

#authentication #firebase #google-sign-in #clean-architecture

License

unknown (license)

Dependencies

device_info_plus, firebase_auth, firebase_core, flutter, get_it, google_sign_in

More

Packages that depend on turbo_fireauth