So you’ve decided to use firebase in your current project but still wondering how to set it up? You are trying to setup firebase for flutter but running into problems? Don’t worry, this post has got you covered. Also if running into problems as regards setting up firebase for flutter, drop your issues and error codes in the comments, I will gladly help. Whew so let’s begin.

First of all, Sign in to Google Firebase Console

Click add project. Select or enter your project name and complete the project creation process. Click create project. You should now have a project name like this. ” Myproject-72638 “.

The ID is randomly assigned by firebase but can be changed to any number you prefer just before you complete project creation. Now is the time to configure our firebase project for our IOS App. On your project dashboard, click on add app. Select add IOS app.

Once here,

Input your Ios bundle ID, this is the id that iddentifies your app. It is usuall in this format, ” ” and can be found by opening your app in XCode, then accessing the General tab in the top-level Runner directory. The value of the Bundle Identifier field is the iOS bundle ID (for example, com.yourcompany.yourproject).

Alternatively you can find it in your android manifest file. Since its usually set during app creation process and is usually the same for both android and IOS versions unless knowingly changed by you.

This application ID is also reffered to as the package name.

You can find it in your module (app-level) Gradle file, usually android/app/build.gradle (example application ID: com.yourcompany.yourproject).

Secondly give the IOS version of your App a nick name eg; “My app IOS”

This is optional if you have already given your Ios app for publish on Itunes.

Click on “Register app” button.

Then next download the config file. It is named GoogleService-Info.plist.

Click Download GoogleService-Info.plist to obtain your Firebase iOS config file. Move the file into ios/Runner folder of your project.

Back in your Firebase Console, click Next to skip the remaining steps, these remaining steps will take place outside your firebase console.

Now Open your IDE, eg: Android Studio.

The Google team provides a collection of plugins to access Firebase services, this collection of plugins together are called FlutterFire plugins. They include, Firebase realtime database, firebase core, firebase firestore, etc.

To add Firebase functionality for our app, we’ll start by adding Firebase Core to our dependencies. Firebase Core is published as an official Flutter Plugin here

Open PubSpec.yaml file in the root of your app project folder, Add the last line below.

    sdk: flutter
  firebase_core: ^0.2.5  # this adds the dependency for Firebase Core

This enables us to use most of the basic Firebase functionalities in our app.

Next we add the individual plugins we want to use for our project eg; Firestore; to do this we also depend on it, by including it in our PubSpec.yaml following like manner as above. The Firestore is listed officially here.

    sdk: flutter
  firebase_core: ^0.2.5  
  cloud_firestore: ^0.8.2+3

After adding the cloud Firestore to our dependencies on PubSpec.yaml.

Open Command line in your project directory and run Flutter Packages Get””

Just by adding a dependency on our Pubspec.yaml file, and running. “Flutter Packages get” via command line or via the option at our IDE, we have now added the firebase plugin to our project.

Leave a Reply