Firebase Setup
Configure Firebase Cloud Messaging for push notifications — order updates, promotions, and real-time alerts.
Firebase Setup
Configure Firebase Cloud Messaging for push notifications — order updates, promotions, and real-time alerts.
Table of Contents
Firebase is a third-party service provided by Google. You must create and maintain your own Firebase account. This is not included in your CodeCanyon purchase.
Firebase offers a generous free tier (Spark plan) that covers most small-to-medium apps. If your usage exceeds the free tier limits, Google will charge you based on their published pricing.
The author of FoodFeast has no control over Firebase pricing and is not responsible for any costs incurred.
Overview#
FoodFeast uses Firebase Cloud Messaging (FCM) to send push notifications for order status updates (placed, preparing, out for delivery, delivered), promotional messages, and real-time alerts.
The app integrates Firebase through the following packages in pubspec.yaml:
| Package | Purpose |
|---|---|
firebase_core | Firebase initialization |
firebase_messaging | Receive and handle push notifications |
awesome_notifications | Display rich local notifications with custom styling |
Create a Firebase project#
Name your project
Type a name (e.g. FoodFeast). This is just a label in the console — it doesn't need to match your app's package name.

Confirm the generated project ID
Firebase auto-generates a unique project ID from the name (e.g. foodfeast-e6669). You'll see this ID again in step 05 when running flutterfire configure.

Gemini in Firebase (optional)
Firebase may ask if you want to enable Gemini AI assistance in the console. This is entirely optional and has no effect on your app.

Enable Google Analytics (recommended)
Analytics is free and pairs with Cloud Messaging for delivery reporting. Leave it enabled unless you have a specific reason not to.


Register the Android app#
Click the Android icon on the project overview page
Enter your Android Application ID. You can find it in:
android/app/build.gradledefaultConfig {
applicationId = "com.example.foodfeast"
...
}
Replace com.example.foodfeast with your own package name if you've changed it.

Download google-services.json
Firebase generates this file. Download it and place it in:
android/app/google-services.json
This file replaces any sample/placeholder file that may already exist in that location.

Verify Gradle plugins
The project already includes the required Gradle configuration. Verify these lines exist:
android/build.gradlebuildscript {
dependencies {
classpath 'com.google.gms:google-services:4.4.0'
}
}
android/app/build.gradle
apply plugin: 'com.google.gms.google-services'
applicationId in build.gradle. A mismatch causes the app to crash on launch.
Register the iOS app (Mac only)#
Add an iOS app in Firebase Console
Click the iOS icon and enter the same Bundle Identifier used in Xcode (found in ios/Runner.xcodeproj → Signing & Capabilities).
Download GoogleService-Info.plist
Open ios/Runner.xcworkspace in Xcode. Drag the downloaded file into the Runner group in the project navigator. Check "Copy items if needed".
Enable Push Notifications capability
In Xcode → Runner → Signing & Capabilities → click + Capability → add Push Notifications and Background Modes (check "Remote notifications").
FlutterFire configure (recommended)#
The easiest way to keep your Firebase config files in sync across Android and iOS at once:
Add the Google services Gradle plugin
Add the plugin as a dependency in your project-level Gradle file (android/build.gradle.kts or android/build.gradle):

Open a terminal in your project

Install the Firebase CLI and FlutterFire CLI
npm install -g firebase-tools
dart pub global activate flutterfire_cli

Log in to Firebase
firebase login

Confirm the CLI login prompt
You may be asked whether to enable Gemini-powered CLI features — this is optional.

Sign in with your Google account
A browser window opens — choose the same Google account you used to create the Firebase project.

Run the configure command from your project root
flutterfire configure

Select your Firebase project
The CLI lists every Firebase project on your account — pick the one you created for FoodFeast.

lib/firebase_options.dart and places the native config files automatically — you won't need to manually download or move google-services.json / GoogleService-Info.plist yourself.Connect the backend (server-side notifications)#
For the backend to send push notifications when order status changes, it needs a Firebase Service Account key.
Generate a private key
In Firebase Console → Project Settings → Service Accounts → Generate new private key. A JSON file downloads.
Upload to your Admin Panel
Log into your FoodFeast Admin Panel → Business Settings → Notification Settings. Upload the JSON file there.
Test it
Create a test order from the app and change its status from the admin panel. You should receive a push notification.
Test notifications#
Send a test message from Firebase Console
Go to Firebase Console → Messaging → Create your first campaign → Firebase Notification messages. Enter a title and body, select your app, and click Send test message.
Troubleshooting#
| Problem | Solution |
|---|---|
| No notification received on Android | Verify google-services.json is in android/app/ and the Application ID matches. |
| No notification on iOS | Must test on a physical device. Verify GoogleService-Info.plist is in the Runner target and Push Notifications capability is enabled. |
[firebase_core/not-initialized] | Run flutterfire configure or manually verify firebase_options.dart has your project's config. |
| Backend doesn't send notifications | Upload the Service Account JSON in Admin Panel → Notification Settings. |
