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.dev
- ⚡ 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.dev, 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.