faui is an authentication UI for Flutter. It registers users with email and password using Firebase security as a service ( SECaaS ). The library provides UI to register user, validate email, sign in, sign out and restore password. Supports silent sign in and access to Firestore.
Find the source code here
If you want to test the library, use the demo project:
apiKey: "AIzaSyA3hshWKqeogfYiklVCCtDaWJW8TfgWgB4"
To create your own Firebase project:
- Sign in to firebase console https://console.firebase.google.com/
- Add, configure and open project
- In the project open tab "Authentication" and then tab "Sign-in Method"
- Click "Email/Password", set "Enable" and click "Save"
- Select "Project Settings" (gear icon)
- Copy your "Web API Key"
Update pubspec.yaml to make sure your project references necessary packages:
dependencies:
...
faui: <latest version>
Check <latest version>
here.
In the beginning of the method build
of the widget that requires
authentication (it should be stateful), add the code:
if (fauiUser == null) {
return fauiBuildAuthScreen(
onExit: this.setState((){...}),
firebaseApiKey: "...",
);
}
Import you need:
import 'package:faui/faui.dart';
Get user email:
fauiUser.email
Sign out:
fauiSignOut()
Silent sign-in:
// Before runApp:
WidgetsFlutterBinding.ensureInitialized();
await fauiTrySignInSilently(firebaseApiKey: '...');
...
// After sign in with dialog:
fauiSaveUserLocallyForSilentSignIn();
To customize UI and/or language, invoke fauiBuildCustomAuthScreen instead of fauiBuildAuthScreen.
See the demo for the details.
Configure basic security rules for your Firestore database. Then utilize the class FauiDbAccess.
See the demo for the details.
flutter pub run test
We follow dart styling.