flutter_performance_testing

pub package License: MIT Flutter Dart

Performance testing utilities and benchmarks for Flutter applications. This package provides comprehensive tools for measuring and analyzing the performance of your Flutter apps across all supported platforms.

Features

  • ๐Ÿš€ Cross-Platform Support: iOS, Android, Web, Windows, macOS, Linux
  • ๐ŸŒ WASM Compatible: Full support for WebAssembly compilation
  • ๐Ÿ“Š Performance Metrics: Frame rate, memory usage, CPU utilization
  • โšก Benchmark Tools: Widget rendering, animation performance, startup time
  • ๐Ÿ” Profiling: Detailed performance analysis and reporting
  • ๐Ÿ“ฑ Real-time Monitoring: Live performance tracking during development
  • ๐Ÿงช Testing Utilities: Performance testing for CI/CD pipelines

Getting Started

Installation

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

dependencies:
  flutter_performance_testing: ^0.0.1

Basic Usage

import 'package:flutter_performance_testing/flutter_performance_testing.dart';

// Measure widget build performance
final stopwatch = Stopwatch()..start();
// Your widget building code here
stopwatch.stop();

final performance = PerformanceMetrics(
  buildTime: stopwatch.elapsedMicroseconds,
  memoryUsage: getCurrentMemoryUsage(),
  frameRate: getCurrentFrameRate(),
);

print('Widget built in ${performance.buildTime} microseconds');

Platform Support

Platform Status Notes
iOS โœ… Full support
Android โœ… Full support
Web โœ… WASM compatible
Windows โœ… Full support
macOS โœ… Full support
Linux โœ… Full support

Performance Metrics

The package provides comprehensive performance metrics:

  • Build Time: Widget rendering performance
  • Memory Usage: RAM consumption tracking
  • Frame Rate: FPS monitoring and analysis
  • CPU Usage: Processor utilization
  • Startup Time: App initialization performance
  • Animation Performance: Smoothness and timing

Advanced Features

Benchmark Suite

import 'package:flutter_performance_testing/benchmark.dart';

final benchmark = BenchmarkSuite();
benchmark.addTest('widget_build', () {
  // Your performance test here
});
final results = await benchmark.run();

Memory Profiling

import 'package:flutter_performance_testing/memory_profiler.dart';

final profiler = MemoryProfiler();
profiler.startTracking();
// Your code here
final report = profiler.generateReport();

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Changelog

See CHANGELOG.md for a list of changes and version history.