← ClaudeAtlas

flutter-firebase-performancelisted

Firebase Performance app performance monitoring
noory-code/noory-ai · ★ 0 · API & Backend · score 74
Install: claude install-skill noory-code/noory-ai
# Flutter Firebase Performance Monitor app startup time, network requests, and custom traces. --- ## Installation ```bash flutter pub add firebase_performance ``` ## Prerequisites - Firebase project configured - `flutterfire configure` has been run --- ## Quick Reference ### Initialization ```dart import 'package:firebase_performance/firebase_performance.dart'; final performance = FirebasePerformance.instance; // check if collection is enabled final isEnabled = await performance.isPerformanceCollectionEnabled(); ``` ### Custom Traces ```dart // measure the performance of a specific operation Future<void> loadData() async { final trace = performance.newTrace('load_data'); await trace.start(); try { final data = await fetchData(); trace.setMetric('item_count', data.length); trace.putAttribute('source', 'api'); } finally { await trace.stop(); } } ``` ### HTTP Metrics ```dart // measure a network request Future<void> fetchWithMetric(String url) async { final metric = performance.newHttpMetric(url, HttpMethod.Get); await metric.start(); try { final response = await http.get(Uri.parse(url)); metric.httpResponseCode = response.statusCode; metric.responseContentType = response.headers['content-type']; metric.responsePayloadSize = response.bodyBytes.length; } finally { await metric.stop(); } } ``` ### Dio Interceptor ```dart class PerformanceInterceptor extends Interceptor { final _metrics = <String, HttpMet