A clean architecture Flutter authentication package that provides Firebase authentication integration with BLoC pattern state management.
- 🔐 Firebase Authentication integration
- 📱 User registration and login
- 🔄 Password reset functionality
- ⚡ BLoC pattern state management
- ✨ Clean architecture principles
- 🧪 Comprehensive test coverage
Add this to your package's pubspec.yaml file:
dependencies:
authentication:
git:
url: https://github.com/wesley990/authentication.git
ref: main- Dart SDK: ">=3.6.0"
- Flutter: ">=1.17.0"
- Firebase project setup with Firebase Auth enabled
- Initialize Firebase in your main.dart:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}- Basic authentication example:
// Create an authentication bloc
final authBloc = AuthenticationBloc();
// Login
authBloc.add(const AuthenticationEvent.signInWithEmailAndPassword(
email: 'user@example.com',
password: 'password123'
));
// Register
authBloc.add(const AuthenticationEvent.signUpWithEmailAndPassword(
email: 'newuser@example.com',
password: 'newpassword123'
));
// Reset password
authBloc.add(const AuthenticationEvent.resetPassword(
email: 'user@example.com'
));
// Logout
authBloc.add(const AuthenticationEvent.signOut());The package uses flutter_bloc for state management with the following states:
AuthenticationInitial- Initial stateAuthenticationLoading- During authentication processesAuthenticationAuthenticated- User is authenticatedAuthenticationUnauthenticated- User is not authenticatedAuthenticationFailure- Authentication process failed
Run the tests using:
flutter test- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License.