fake_firebase_performance 1.0.0 copy "fake_firebase_performance: ^1.0.0" to clipboard
fake_firebase_performance: ^1.0.0 copied to clipboard

Fake Firebase Performance for use during Flutter unit & widget tests.

Fake Firebase Performance #

pub package

Fakes to write unit tests for apps using Firebase Performance monitoring. Instantiate a FakeFirebasePerformance, then pass it around your project to replace FirebasePerformance.instance. This fake acts like FirebasePerformance except it will load mocked data instead.

Usage #

A simple usage example #

import 'package:fake_firebase_performance/fake_firebase_performance.dart';

void main() async {
  final perf = FakeFirebasePerformance();

  perf.isPerformanceCollectionEnabled(); // will return false

  perf.newTrace('test'); // will do nothing
  perf.newHttpMetric("https://example.com/", HttpMethod.Get); // will do nothing
}

This perf object needs to replace the real FirebasePerformance.instance during testing. You can do this for example with Riverpod or by doing something like this:

await tester.pumpWidget(
  MaterialApp(
    title: 'FirebasePerformance Example',
    home: MyApp(overrideFirebasePerformance: perf),
  ),
);

Missing functionality #

  • perf.app will throw
  • perf.pluginConstants is empty
  • perf.newTrace() does nothing
  • perf.newHttpMetric() does nothing

Compatibility table #

firebase_performance fake_firebase_performance
>=0.8.0 1.0.0

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1
likes
130
pub points
49%
popularity

Publisher

unverified uploader

Fake Firebase Performance for use during Flutter unit & widget tests.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (LICENSE)

Dependencies

firebase_core, firebase_performance, flutter

More

Packages that depend on fake_firebase_performance