Configure Firebase and Flutter on 3 platforms

Ahmadreza Shamimi
2 min readMar 26, 2023

--

Create a new Flutter project by running the command flutter create project_name in your terminal.

Create a new Firebase project and add the necessary Firebase services (such as Authentication, Realtime Database, Firestore, Storage, etc.) that you need for your app. Follow the Firebase documentation for each service to configure them properly.

- For Android:

Go to the Firebase console, click on the gear icon next to “Project Overview” and select “Project settings”.

  • In the “General” tab, scroll down to the “Your apps” section and click on the “Add app” button.
  • Select “Android” and follow the instructions to register your app. You will need to provide your app’s package name, SHA-1 fingerprint, and an optional app nickname.
  • Download the google-services.json file and add it to the android/app/ directory of your Flutter project.
  • Add the necessary dependencies to your app-level build.gradle file.

- For iOS:

  • Go to the Firebase console, click on the gear icon next to “Project Overview” and select “Project settings”.
  • In the “General” tab, scroll down to the “Your apps” section and click on the “Add app” button.
  • Select “iOS” and follow the instructions to register your app. You will need to provide your app’s bundle ID and an optional app nickname.
  • Download the GoogleService-Info.plist file and add it to the ios/Runner/ directory of your Flutter project.
  • Add the necessary dependencies to your Podfile and run pod install in the ios/ directory.

- For Web:

  • Go to the Firebase console, click on the gear icon next to “Project Overview” and select “Project settings”.
  • In the “General” tab, scroll down to the “Your apps” section and click on the “Add app” button.
  • Select “Web” and follow the instructions to register your app. You will need to provide your app’s nickname and an optional Firebase Hosting site name.
  • Copy the Firebase SDK snippet and add it to your Flutter project’s index.html file.
  • Add the necessary dependencies to your pubspec.yaml file.

Once you have completed these steps, you should be able to use the Firebase services in your Flutter app on Android, iOS, and web. Don’t forget to test your app on all platforms to make sure everything is working as expected!

You can watch this video on youtube:

https://youtu.be/fXCq4FSoNHw

--

--

Ahmadreza Shamimi
Ahmadreza Shamimi

Written by Ahmadreza Shamimi

I'm Ahmadreza Shamimi with an experienced with over 10 years of experience coding with web and mobile platforms.

No responses yet