fireauth 0.0.5 copy "fireauth: ^0.0.5" to clipboard
fireauth: ^0.0.5 copied to clipboard

outdated

A Flutter Package that aims to simplify Flutter Firebase Authentication and streamline development.

Fireauth #

FireAuth is a Flutter Package that aims to simplify Flutter Firebase Authentication and streamline app development. It provides a intuitive way to access Parts of the Firebase Authentication Suite and reduces the amount of time you have to spend on it. Works for both Flutter Native and Flutter Web!

Install #

Add this line to your pubspec.yaml:

dependencies:
  fireauth: ^0.0.5
  #fireauth: 0.0.5-legacy if you rely on the older firebase dependencies

Then run this command:

$ flutter packages get

Then add this import:

import 'package:fireauth/fireauth.dart';

Project Firebase Setup #

Setting up Firebase correctly can sometimes be a tedious process. Hence, I have come up with a python script that will do most of the hardwork for you! It also contains well documented instructions so that the entire process is very smooth! Use My FireSetup Utility to Properly add Firebase to your Flutter App

Platform Support #

Currently Supported Authentication Methods: #


Usage #

Step 1: Initializing Firebase (main.dart) #

void main() async {
  //This initializes Firebase Accordingly (Important)
  await initializeFirebase();  //This method is from the fireauth package
  runApp(YourApp());
}

Step 2: Wrap your Material App with GlobalFirebaseAuthenticationProvider #

//Allows the Authentication Methods to be accessible from anywhere in the widget tree
return GlobalFirebaseAuthenticationProvider(
 child: MaterialApp(
   home: AppOrigin(),
 ),
);

Step 3: Use the AuthenticationManager #

//This basically acts like a Gateway, If youre logged in, it shows the destinationFragment
//else it shows the loginFragment (It Remembers the Authentication State too!)

return AuthenticationManager(
  loginFragment: LoginPage(),
  destinationFragment: HomePage(),
  
  //Other Arguements can be explored in the IDE, documentation has been provided
);

Using the AuthController #

The AuthController is a Dart class that contains several static methods that exposes useful functions!

For more information on these methods, take a look at them using the IDE, they are very well documented, but this is all you need for it to work in the default way

Sign In With Google #

AuthController.signInWithGoogle(
  context,
  onError: (String e) {
    print(e);
  },
),

Anonymous SignIn #

AuthController.signInAnonymously(context),

Phone SignIn #

AuthController.signInWithPhoneNumber(
    context,
    phoneNumber: phoneNumberController.value.text,
    onError: (e) {
      ...
    },
    onInvalidVerificationCode: () {
      ...
    },
  );
},

Register & Login With Email & Password #

AuthController.registerWithEmailAndPassword(
  context,
  email: "[email protected]",
  password: "abc123",
  onError: (String e) {
    ...
  },
);

SignIn With Email & Password #

AuthController.signInWithEmailAndPassword(
  context,
  email: "[email protected]",
  password: "abc123",
  onError: (String e) {
    ...
  },
  onIncorrectCredentials: () {
    ...
  },
);

Logout #

AuthController.logout(context);

Get Current User #

AuthController.getCurrentUser(
  context,
  //Optional Arguement, if not provided, It just returns a Firebase User
  customMapping: (user) => {
    'name': user.displayName,
    'email': user.email,
  },
);

Other Widgets #

GoogleSignIn Button #

If you just want a ready to use button that enables Google SignIn, This is the Widget you're looking for!

//has some additional arguements that you can see from your IDE, as it is very well documented
GoogleSignInButton()

Anonymous SignIn Button #

If you just want a ready to use button that enables Anonymous SignIn, This is the Widget you're looking for!

//has some additional arguements that you can see from your IDE, as it is very well documented
AnonymousSignInButton()

Future Plans #

  • Test FireAuth on iOS
  • Implement Twitter, Github, Microsoft, Apple, Facebook and other such AuthenticationMethods
  • Move FireAuth to sound null safety

FireAuth ChangeLogs #

4
likes
0
pub points
42%
popularity

Publisher

unverified uploader

A Flutter Package that aims to simplify Flutter Firebase Authentication and streamline development.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

firebase_auth, firebase_core, flutter, google_sign_in, provider, shared_preferences, toast

More

Packages that depend on fireauth