firebase_performance 0.1.0+4

  • Example
  • Installing
  • Versions
  • 97

Google Performance Monitoring for Firebase #

pub package

A Flutter plugin to use the Google Performance Monitoring for Firebase API.

For Flutter plugins for other Firebase products, see

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

Usage #

To use this plugin, add firebase_performance as a dependency in your pubspec.yaml file. You must also configure firebase performance monitoring for each platform project: Android and iOS (see the example folder or for step by step details).

You can confirm that Performance Monitoring results appear in the Firebase console. Results should appear within 12 hours.

Define a Custom Trace #

A custom trace is a report of performance data associated with some of the code in your app. To learn more about custom traces, see the Performance Monitoring overview.

final Trace myTrace = FirebasePerformance.instance.newTrace("test_trace");

final Item item = cache.fetch("item");
if (item != null) {
} else {


Add monitoring for specific network requests #

Performance Monitoring collects network requests automatically. Although this includes most network requests for your app, some might not be reported. To include specific network requests in Performance Monitoring, add the following code to your app:

class _MetricHttpClient extends BaseClient {

  final Client _inner;

  Future<StreamedResponse> send(BaseRequest request) async {
    final HttpMetric metric = FirebasePerformance.instance
        .newHttpMetric(request.url.toString(), HttpMethod.Get);

    await metric.start();

    StreamedResponse response;
    try {
      response = await _inner.send(request);
        ..responsePayloadSize = response.contentLength
        ..responseContentType = response.headers['Content-Type']
        ..requestPayloadSize = request.contentLength
        ..httpResponseCode = response.statusCode;
    } finally {
      await metric.stop();

    return response;

class _MyAppState extends State<MyApp> {
  Future<void> testHttpMetric() async {
    final _MetricHttpClient metricHttpClient = _MetricHttpClient(Client());

    final Request request =
        Request("SEND", Uri.parse(""));


Getting Started #

See the example directory for a complete sample app using Google Performance Monitoring for Firebase.

0.1.0+4 #

  • Remove deprecated methods for iOS.
  • Fix bug where Trace attributes were not set correctly.

0.1.0+3 #

  • Log messages about automatic configuration of the default app are now less confusing.

0.1.0+2 #

  • Fixed bug where Traces and HttpMetrics weren't being passed to Firebase on iOS.

0.1.0+1 #

  • Log a more detailed warning at build time about the previous AndroidX migration.

0.1.0 #

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

0.0.8+1 #

  • Bump Android dependencies to latest.

0.0.8 #

  • Set http version to be compatible with flutter_test.

0.0.7 #

  • Added missing http package dependency.

0.0.6 #

  • Bump Android and Firebase dependency versions.

0.0.5 #

Added comments explaining the time it takes to see performance results.

0.0.4 #

  • Formatted code, updated comments, and removed unnecessary files.

0.0.3 #

  • Updated Gradle tooling to match Android Studio 3.1.2.

0.0.2 #

  • Added HttpMetric for monitoring for specific network requests.

0.0.1 #

  • Initial Release.


firebase_performance_example #

Demonstrates how to use the firebase_performance plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  firebase_performance: ^0.1.0+4

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:firebase_performance/firebase_performance.dart';
Version Uploaded Documentation Archive
0.1.0+4 Mar 1, 2019 Go to the documentation of firebase_performance 0.1.0+4 Download firebase_performance 0.1.0+4 archive
0.1.0+3 Feb 21, 2019 Go to the documentation of firebase_performance 0.1.0+3 Download firebase_performance 0.1.0+3 archive
0.1.0+2 Feb 12, 2019 Go to the documentation of firebase_performance 0.1.0+2 Download firebase_performance 0.1.0+2 archive
0.1.0+1 Feb 8, 2019 Go to the documentation of firebase_performance 0.1.0+1 Download firebase_performance 0.1.0+1 archive
0.1.0 Jan 29, 2019 Go to the documentation of firebase_performance 0.1.0 Download firebase_performance 0.1.0 archive
0.0.8+1 Oct 12, 2018 Go to the documentation of firebase_performance 0.0.8+1 Download firebase_performance 0.0.8+1 archive
0.0.8 Oct 2, 2018 Go to the documentation of firebase_performance 0.0.8 Download firebase_performance 0.0.8 archive
0.0.5 Jun 25, 2018 Go to the documentation of firebase_performance 0.0.5 Download firebase_performance 0.0.5 archive
0.0.4 Jun 6, 2018 Go to the documentation of firebase_performance 0.0.4 Download firebase_performance 0.0.4 archive
0.0.2 May 29, 2018 Go to the documentation of firebase_performance 0.0.2 Download firebase_performance 0.0.2 archive

All 11 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 6, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.3.3


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
firebase_core ^0.3.0
http ^0.12.0