Firebase Intergation

Set up Firebase project

To start using Firebase with the application, you first have to create a new Firebase project. Follow the steps below:

  • Create a new Firebase project by going to the Firebase console

  • Click on Add project.

  • Enter a Project name and click on Continue.

  • Next, you will be asked whether you want to enable Google Analytics for the project. We won’t be needing analytics, as this is just a sample project. Click on Create project.

  • If you want to enable Google Analytics anyway, then you will be prompted to select a Google Analytics account on the next screen:

  • Wait for the project to be created, and you will be navigated to the Firebase dashboard of the project.

Platform configurations

Now, we have to complete the platform-specific Firebase configurations. Though we are using Flutter (which is a cross-platform framework), we still have to integrate the Firebase project separately for each platform. Flutter 2.0 has support for Android, iOS and web in its stable channel, so we will be configuring for all three platforms.

Android setup

First of all, let’s configure for the Android platform.

  • Select the Android icon from the Firebase dashboard.

  • Enter the Android package name, an app nickname and the SHA-1. Click on Register app.

  • Download the google-services.json file, and place it in the android -> app directory. Click on Next.

  • Just follow the instructions, and add the required code snippets to your project. Click on Next.

  • You have successfully configured Firebase for Android. On the final step, click on Continue to console to go back to the dashboard.

iOS setup

  • Select the iOS icon on the dashboard.

  • Enter your iOS bundle ID and an app nickname. Click on Register app.

  • Download the GoogleService-Info.plist file. Click on Next.

  • Go back to your project, open the ios folder using Xcode, and drag and drop the file that you downloaded into the Runner subfolder. When a dialog box appears, make sure that Runner is selected in the “Add to targets” box. Then click Finish.

  • You can skip steps 3 and 4, as they are automatically configured by the Flutter Firebase plugin that we will be adding soon. Click on Continue to console to go back to the dashboard.

For a more graphical guideline, check the link

Last updated