We use flutterfire plugins to integrate app with firebase services, a long with flutterfire cli to generate all firbase files and configurations for both platform android and ios.
flutterfire cli depends on firebase cli tool so we need to install flutter cli first.
1- for mac or linux you can simply run this command from terminal
curl -sL https://firebase.tools | bash
2- for windows check firebase cli docs 🌚
3- login to your firebase account using this commnd
firebase login
(This command connects your local machine to Firebase and grants you access to your Firebase projects.)
1- install flutterfire cli.
dart pub global activate flutterfire_flavor_cli
2- run flutterfire configure command from you project path and follow up the commnd options.
flutterfire configure
3- on main_production.dart
file intizalize firebase app.
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform,);
and make sure you import firebase_options_production.dart
file.
4- on main_staging.dart
file intizalize firebase app
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform,);
and make sure you import firebase_options_staging.dart
file.
5- run flutter clean
and flutter pub get
commands.
6- run project and make sure every thing work prefectly.
7- commits changes.