A Flutter starter project that contains splash, sign in, sign up, password reset and email verification. it uses Firebase for authentication and the BLoC pattern (flutter_bloc library) for state management.
Project was only tested on Android and the web (online demo).
- Sign In (email + password or Google Sign-In).
- Sign Up.
- Password reset.
- Email verification.
- Firebase Analytics.
- Flutter web support.
lib/src/configuration.dart
allows you to quickly enable/disable options.
kUseGoogleASignIn
: Google Sign-In; not supported for Flutter web as of now.kUseFirebaseAnalytics
: Firebase Analytics; not supported for Flutter web as of now.kUseFlutterBlocObserver
: Flutter_bloc oberver.
- Create a Firebase project in the Firebase Console and add an Android app to the project. Please follow the installation instructions from the Firebase Auth package.
- In the Firebase console, enable Email/Password authentication by doing: Authentication > SIGN-IN METHOD > Email/Password > Enable > SAVE
- In the Firebase console, enable Google authentication by doing: Authentication > SIGN-IN METHOD > Google > Enable > SAVE
- In the Firebase console, update the email address verification template by doing: Authentication > TEMPLATES > Email address verification
- In the Firebase console, update the password reset template by doing: Authentication > TEMPLATES > Password reset
Important: You need the latest version of the Flutter SDK from the beta channel to compile this project. See Building a web application with Flutter.
- Add web support by running (restart your IDE aftert running the command):
flutter config --enable-web
- Rename
web/SAMPLE_firebase.js
asweb/firebase.js
and update its content with the Firebase SDK snippet from the Firebase Console (see Resources). - Follow the instructions from google_sign_in_web README and include your OAuth ID to
web/index.html
, line 42. - Check this stackoverflow thread if you encounter the “Browser or app may not be secure. Try using a different browser.” error with Google Sign-In.
- Add Firebase to your JavaScript project
- firebase_auth README
- firebase_auth_web README
- google_sign_in_web README
- thehappyharis, Flutter Web: Google Sign In
Sign In Screen | Sign Up Screen |
---|---|
Password Reset Screen | Home Screen |
---|---|
Here are a few resources to get you started if you are new to Flutter:
- Official Flutter documentation
- Flutter youtube channel
- Lab: Write your first Flutter app
- Cookbook: Useful Flutter samples
- Stack Overflow, How to change package name in flutter?
- Felix Angelov, flutter_bloc: Flutter Firebase Login Tutorial
- Remi Rousselet, Getting Started: Creating Your Flutter Project
- Ryan Edge, Dash Tips: Using Bloc with Freezed
- Adam Cooper, Continuous Integration for Flutter with GitHub Actions
- Sam Debruyn, Easy localization in Flutter with continuous integration
- Gaspard Merten, The Flutter Guide to Firebase Analytics
- thehappyharis, Progressive Web App (PWA) in Flutter Web
Christophe Bonello (LinkedIn) (Twitter)
This project is a fully open source project, and contributions are welcome.
Copyright (c) 2020 Christophe Bonello
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.