Easiest Steps On How To Save Data To Firebase Without Adding google-services.json File In Your Flutter App

Often at times, the traditional way of integrating Firebase into your Flutter project is by downloading and adding the google-services.json file in your Flutter project.

But, in this article, you will learn how to store data to Firebase Cloud Firestore without downloading and adding the google-services.json to your Flutter project.

By the end of this article, you will learn the following:

  • How to set up Firebase Cloud Firestore.

  • Setting up a PipeDream and Connect your Firebase project to PipeDream.

  • Building a simple Flutter app to connect to PipeDream.

A quick definition for you

Firebase Cloud Firestore is a NoSQL document database that lets you easily store, sync, and query data for your mobile and web apps at a global scale.

So let's get started.

Step 1: Set up your Cloud Firestore

To set up Cloud Firestore, go to https://console.firebase.google.com/ and click on the plus + icon to add a project.

1_uXcREQhnhXE58ddWx_huPA.png Enter a project name and click on Continue to proceed to the next step (See image below)

1_uXcREQhnhXE58ddWx_huPA.png Enable Google Analytics, click on Continue to move to the next page.

1_uXcREQhnhXE58ddWx_huPA.png Choose or create a Google Analytics account and click “Create project” to create a new firebase project.

1_uXcREQhnhXE58ddWx_huPA.png After the project is created successfully, Firebase will redirect you to your project homepage.

1_uXcREQhnhXE58ddWx_huPA.png On the sidebar of your Firebase project, click on “Build” and select “Firestore”. You will see the Cloud Firestore page with the “Create database” button, click on it to create a Cloud Firestore database.

1_uXcREQhnhXE58ddWx_huPA.png Firebase will show a pop-up for you to select which rule you want to be applied to your Cloud Firestore database. Select “Start with test mode” and click on Next.

1_uXcREQhnhXE58ddWx_huPA.png Select a location where you want your Cloud Firestore to be stored and click on Enable to finish up the setup process.

1_uXcREQhnhXE58ddWx_huPA.png On successful completion, your Firebase Cloud Firestore database will look like this image below

1_uXcREQhnhXE58ddWx_huPA.png Congratulations on your first step in setting up Firebase Cloud Firestore.

Step 2: Setting up Pipe Dream

What is Pipedream? Pipedream is an integration platform for developers to build and run workflows that integrate apps and data.

Go to https://pipedream.com/, at the top right corner of the site, click on the “SIGN UP” button (this is if you don’t have an account) But if you have a pipedream account, then click the “Sign in” button.

1_uXcREQhnhXE58ddWx_huPA.png On successful sign-in, your PipeDream dashboard will look like this image below.

1_uXcREQhnhXE58ddWx_huPA.png Click on the Explore tab on the left-hand side and search for Firebase.

1_uXcREQhnhXE58ddWx_huPA.png Click on the Firebase Admin SDK and scroll down to Popular Firebase Admin SDK Integrations and click on the TRY IT button for Save Event to Firestore with Firebase Admin SDK API

1_uXcREQhnhXE58ddWx_huPA.png To be able to integrate Firebase to PipeDream, you need to connect the Firebase project you have created earlier.

To do so, click on the CONNECT FIREBASE ADMIN SDK button so as the sync your Firebase project to PipeDream.

1_uXcREQhnhXE58ddWx_huPA.png Creating a new connection to Firebase Admin SDK requires projectId, clientEmail, and privateKey.

1_uXcREQhnhXE58ddWx_huPA.png To be able to add this required information (projectId, clientEmail, and privateKey), go to the Firebase project you have created earlier, click on the settings icon, and click on the Project settings option.

1_uXcREQhnhXE58ddWx_huPA.png On the Project settings page, click on service accounts and click on Generate new private key button.

1_uXcREQhnhXE58ddWx_huPA.png Click on Generate Key button to download your Firebase keys.

*Note: Your private key gives access to your project’s Firebase services and it should be kept private.

Do not store your Firebase private key in a public repository.*

1_uXcREQhnhXE58ddWx_huPA.png Open the downloaded Firebase private key.

Copy and paste the required information like projectId, clientEmail, and privateKey.

Note: When adding the private key, please add the full string included in the JSON file, the private key must start with -----BEGIN PRIVATE KEY----- and end with -----END PRIVATE KEY-----, with all newline characters included.

Click on the button SAVE to connect your Firebase project to PipeDream.

1_uXcREQhnhXE58ddWx_huPA.png For DeliveryId enter {{event.body.email}}, for FirestoreCollection enter /test/ while for Data enter {{event.body}}

1_uXcREQhnhXE58ddWx_huPA.png When done, scroll up and click on CREATE SOURCE to deploy your project.

1_uXcREQhnhXE58ddWx_huPA.png When deployed successfully, pipedream will create an endpoint (URL) for your project which you can use to communicate to the pipedream project.

Click on the Off button, to switch the trigger function On.

Note: If the trigger function is switched to on, your pipedream project will always be triggered whenever there is an event.

1_uXcREQhnhXE58ddWx_huPA.png Congratulations once again, you have completed the second step!!!

Step 3: Building a simple Flutter app to connect to PipeDream

You can create a new flutter app by using either Visual Studio, IntelliJ, or Android studio.

Open “pubspec.yaml” file, and install the following package.


Open your main.dart file, and modify your source code to look like the code below:

Finally, create a new dart file called service.dart inside the lib folder, add the code below to your newly created service.dart file

Run your app on your smartphone or emulator.


#Conclusion if you go to your newly created Firestore database you will see a new collection created and data stored in it.

1_uXcREQhnhXE58ddWx_huPA.png I hope this blog will provide you with sufficient information and insight on how to build a simple flutter app that stores data to Firebase without downloading and adding the google-services.json file into your Flutter project.

P.S: Here is the source code for the project you just worked on.

If you found this article helpful and educating, please hit the like and clap button, and also don't forget to share this article with your friends.

To get my latest updates and happenings from the world of Flutter, and mobile development, follow me on Twitter, Facebook, Linkedin, and Github.

My name is Promise Amadi. I am a writer and Flutter Developer. I work with startups across the globe to build mobile solutions using Flutter.

No Comments Yet