firebase_performance 0.0.1

  • Example
  • Installing
  • Versions
  • 95

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).

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.

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

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


Getting Started #

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

0.0.1 #

  • Initial Release


// Copyright 2017, the Flutter project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'package:flutter/material.dart';

import 'package:firebase_performance/firebase_performance.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  FirebasePerformance _performance = FirebasePerformance.instance;
  bool _isPerformanceCollectionEnabled = false;
  String _performanceCollectionMessage =
      'Unknown status of performance collection.';
  bool _traceHasRan = false;

  void initState() {

  Future<void> _togglePerformanceCollection() async {
    await _performance

    final bool isEnabled = await _performance.isPerformanceCollectionEnabled();
    setState(() {
      _isPerformanceCollectionEnabled = isEnabled;
      _performanceCollectionMessage = _isPerformanceCollectionEnabled
          ? 'Performance collection is enabled.'
          : 'Performance collection is disabled.';

  Future<void> _testTrace() async {
    final Trace trace = _performance.newTrace("test");
    trace.incrementCounter("counter1", 16);
    trace.putAttribute("favorite_color", "blue");

    await trace.start();

    int sum = 0;
    for (int i = 0; i < 10000000; i++) {
      sum += i;

    await trace.stop();

    setState(() {
      _traceHasRan = true;

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Firebase Performance Example'),
        body: new Center(
            child: new Column(
          children: <Widget>[
            new Text(_performanceCollectionMessage),
            new RaisedButton(
              onPressed: _togglePerformanceCollection,
              child: const Text('Toggle Data Collection'),
            new RaisedButton(
              onPressed: _testTrace,
              child: const Text('Run Trace'),
            new Text(
              _traceHasRan ? 'Trace Ran!' : '',
              style: const TextStyle(
                  color: Colors.lightGreenAccent, fontSize: 25.0),

Use this package as a library

1. Depend on it

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

  firebase_performance: ^0.0.1

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.2.0 May 7, 2019 Go to the documentation of firebase_performance 0.2.0 Download firebase_performance 0.2.0 archive
0.1.1 Apr 22, 2019 Go to the documentation of firebase_performance 0.1.1 Download firebase_performance 0.1.1 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

All 13 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 May 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.0
  • pana: 0.12.15
  • Flutter: 1.5.8


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Package is getting outdated. (-0.82 points)

The package was last published 52 weeks ago.


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