build an app using flutter and Firebase

Creating a New Firebase Project

First, log in with your Google account to manage your Firebase projects. From within the Firebase dashboard, select the Create new project button and give it a name:

Adding Android support

Registering the App

In order to add Android support to our Flutter application, select the Android logo from the dashboard. This brings us to the following screen:

com.example.flutterfirebaseexample
...
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId 'com.example.flutterfirebaseexample'
...
}
...

Downloading the Config File

The next step is to add the Firebase configuration file into our Flutter project. This is important as it contains the API keys and other critical information for Firebase to use.

Adding the Firebase SDK

We’ll now need to update our Gradle configuration to include the Google Services plugin.

buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
...
// Add this line
classpath 'com.google.gms:google-services:4.3.6'
}
}
allprojects {
...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
...
}
}
apply plugin: 'com.android.application'
// Add this line
apply plugin: 'com.google.gms.google-services'
dependencies {
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:28.0.0')
// Add the dependencies for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
}

Adding iOS Support

In order to add Firebase support for iOS, we have to follow a similar set of instructions.

Registering an App

Once again, we’ll need to add an “iOS Bundle ID”. It is possible to use the “Android package name” for consistency:

Downloading the Config File

In this step, we’ll need to download the configuration file and add this to our Xcode project.

  • 🤝 I’m looking for help with Full-Stack Web Development
  • 👨‍💻 All of my projects are available https://github.com/jassemb
  • ⚡ Fun fact Coding is a passion and not profession.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store