flutter_perf_monitor 0.0.2
flutter_perf_monitor: ^0.0.2 copied to clipboard
Real-time performance monitoring with FPS tracking and memory usage for Flutter applications
Flutter Performance Monitor #
A comprehensive performance monitoring package for Flutter applications that provides real-time FPS tracking, memory usage monitoring, and CPU usage statistics across all platforms.
Features #
- π― Real-time FPS tracking - Monitor frame rates in real-time
- πΎ Real memory monitoring - Track actual memory consumption using platform APIs
- π₯οΈ Real CPU monitoring - Monitor actual CPU usage with native implementations
- π Performance metrics - Comprehensive performance analytics
- π Live updates - Real-time performance data updates
- π± Universal platform support - Works on iOS, Android, Web, Windows, macOS, and Linux
- β‘ WASM compatible - Future-proof for Flutter Web improvements
- π Perfect quality score - 160/160 Pana score for pub.flutter-io.cn
- β‘ Lightweight - Minimal performance impact on your app
Getting Started #
Installation #
Add this to your package's pubspec.yaml
file:
dependencies:
flutter_perf_monitor: ^0.0.2
Usage #
import 'package:flutter_perf_monitor/flutter_perf_monitor.dart';
void main() async {
// Initialize the performance monitor
await FlutterPerfMonitor.initialize();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Stack(
children: [
// Your app content
YourAppContent(),
// Performance monitor widget overlay
PerfMonitorWidget(
alignment: Alignment.topRight,
showFPS: true,
showMemory: true,
showCPU: true,
),
],
),
),
);
}
}
API Reference #
FlutterPerfMonitor #
The main class for performance monitoring.
Methods
initialize()
- Initialize the performance monitorstartMonitoring()
- Start performance monitoringstopMonitoring()
- Stop performance monitoringgetFPS()
- Get current FPS valuegetMemoryUsage()
- Get current memory usagegetCPUUsage()
- Get current CPU usagegetTotalMemory()
- Get total available memorygetAvailableMemory()
- Get available memory
PerfMonitorWidget #
A widget that displays performance metrics.
Platform Support #
This package provides universal platform support with native implementations:
- β iOS - Native mach APIs for real memory and CPU monitoring
- β Android - ActivityManager integration for system metrics
- β Web - Browser APIs with intelligent fallbacks
- β Windows - PDH and Process APIs for system monitoring
- β macOS - Native mach APIs for performance metrics
- β Linux - /proc filesystem integration
- β WASM - Compatible with Flutter Web WASM runtime
Quality Score #
This package has achieved a perfect 160/160 Pana score on pub.flutter-io.cn, ensuring:
- β Zero linting issues
- β Perfect code formatting
- β Comprehensive documentation
- β Universal platform support
- β Modern Flutter/Dart compatibility
Example #
See the example directory for a complete working example.
Contributing #
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Support #
If you encounter any problems or have suggestions, please file an issue at the GitHub repository.
Changelog #
See CHANGELOG.md for a list of changes and version history.