firebase performance monitoring

·

1 min read

Source: https://firebase.google.com/docs/flutter/setup?platform=ios

Pre-requisite: Get access to Firebase console

Then Install the command line tools

\> install the Firebase CLI.

> firebase login

> dart pub global activate flutterfire_cli

#Configure app to use firebase

> flutterfire configure

This will add firebase_options.dart under /lib Contains all properties to push metrics

Initialize Firebase in App

flutter pub add firebase_core

In my_app.dart / main.dart

import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';

await Firebase.initializeApp(
  options: DefaultFirebaseOptions.currentPlatform,
);

flutter run -v lib/main.dart

Adding plugin

flutter pub add firebase_performance

flutterfire configure
flutter run

Default metrics

Following above steps, we see some metrics in Firebase console.

Attributes pushed include -

  • App start trace — A trace that measures the time between when the user opens the app and when the app is responsive

  • App-in-foreground trace — A trace that measures the time when the app is running in the foreground and available to the user

  • App-in-background trace — A trace that measures the time when the app is running in the background