local_firebase_auth 0.1.0
local_firebase_auth: ^0.1.0 copied to clipboard
An experimental dart package that mocks (emulates) the firebase_auth plugin for quick and offline development.
local_firebase_auth #
An experimental dart package that mocks (emulates) the firebase_auth plugin for quick and offline development.
Intended to be used solely for development. #
Usage #
-
Depend on the package by adding it to your pubspec.yaml dependencies.
local_firebase_auth: <latest_version> -
Import the library.
import 'package:local_firebase_auth/local_firebase_auth.dart';
When using this package alongside the official firebase plugin, it's advisable to import with a prefix to prevent conflict since it same class names except LocalFirebaseAuth (ofc 😜). Eg.
import 'package:local_firebase_auth/local_firebase_auth.dart' as localAuth;
- Be sure to initialize the package before using. An exception will be raised if the package is not initialized before usage.
LocalFirebaseAuth.initialize('appName');
- Use it as you would the official plugin. For instance, you can create a new user as:
final UserCredential result = await LocalFirebaseAuth.instance.createUserWithEmailAndPassword(
email: email,
password: pass,
);
final User user = result.user;
print(user.uid);
Supported methods #
Since this is a mock and experimental package, it is in no way meant as a replace for Firebase but for use quick and offline development use-cases.
The following methods are currently available:
| Method | Signature | Parameters |
|---|---|---|
| createUserWithEmailAndPassword | Future<UserCredential> |
String email, String password |
| signInAnonymously | Future<UserCredential> |
None |
| signInWithEmailAndPassword | Future<UserCredential> |
String email, String password |
| signOut | Future<void> |
None |
Get Current User #
final User user = LocalFirebaseAuth.instance.currentUser;
Contributing #
This project is fully open-source. Feel free to open issues when you realize one and PRs are welcome as well.
Official Plugins Documentation #
For the full documentation of the official Firebase plugins, please see the documentation available at https://firebase.flutter.dev
License #
This project has been licensed under the MIT License. Check the LICENSE file for the details.