If you are a mobile app developer then you might have known what is Firebase. It’s a platform for developing mobile apps owned by Google in 2014. It offers various features like as an ML Kit, and Cloud storage Authentication which are important for developing modern mobile apps. Also, it offers other services which include performance monitoring, Google Analytics, and Crashlytics to guide you enhance the app quality.
This guide is all about how to connect the flutter with Firebase on Mac PCs so that you can make use of the powerful services offered by the API platform in the future endeavors.
Must have a Google account
In order to make use of the Firebase service and the Google Cloud Platform, you will have to own a Google Account. If you don’t have then you will have to register for one. This tutorial is all about how to connect the Flutter app that you have already to the Firebase platform. You might have the hello_world app ready at the end of the tutorial in the simulator and know how to alter the app by changing the main.dart file.
Firebase project – Creating one
In order to use your Flutter app developer with the Firebase, you will have to first make a project or maybe create one.
- Visit the Firebase console
- Now click the large “Add project” option
- Now click the Project name
- You have any anything for instance. And the Firebase will append a unique ID to the project name automatically.
- Now choose a Cloud Firestore location
- Now read and accept the Terms and Conditions
- Once done, scroll down and click “Create Project”
The platform might take some time to go through your application. Once completed, then click the continue option to open the overview page of the project you made.
Configuring an iOS app
- Launch the setup wizard for iOS in the project overview page
- You will now see the setup wizard and add it in the iOS bundle ID. Check whether the register app is lit up then click on it.
- Now you will have to download the GoogleService – Info.plist config list and add it to the iOS project root file, then proceed the next.
- Just go with the instructions and then add the Firebase SDK and proceed the next
- Make the changes needed in the AppDelegate as suggested by the setup wizard then choose next.
- Now check the root folder to run the application. After some time, you might see the setup wizard showing that the app has been included to Firebase. Then choose “Continue to the Console” to complete the setup.
Now you have added Firebase to the Flutter app successfully. In spite of having both the flutter and Firebase from Google awesome, it’s actually a great software engineering practice to have choices over the B and C.
How is the app behaving?
Now let’s see the performance.
As per the document, it can analyze the application performance glitches that happen on a user’s device. Use trace to track the performance of certain app parts and go through a summarized view in the Firebase console. Keep up with the application startup time and check the HTTP requests without working on the code.
How to use it?
You will have to define the traces on your own also track network requests
What is a trace?
A trace can record the data between two different performance segments in your application.
How to use it in Flutter?
- You can make use of it by initializing tracing
- Then you have to start the trace
- Then stop it
- You can also use your logic in between the traces
Note – this data will be shown in the Firebase Performance Dashboard
Monitoring the network request
- Make use of the feature plugin that is available known as BaseClient
- Create a class that goes beyond the BaseClient
- You will have to overrule the 2nd class method
- Create HttpMetric – the URL, Type of Http Request
- Begin the Http Metric
- Then stop
- And complete the snippet
Crashlytics is the Firebase’s chief crash. Using the Firebase_crashlytics, it’s possible to integrate it for Flutter.
- Integrate it for Android and iOS
- Then start the Crashlytics in the app
- You will get notifications for the errors by settings
- You can check for errors under the Firebase, quality, and Crashlytics
Why Flutter is the future of mobile app development
- Powered by Dart
- It can run both on iOS and Android
- User Interface development
- Provides lots of great features and libraries
- Backend development
As mentioned the possibilities are endless and practical with flutter so you can create even the tougher app with flutter with ease.