flutter_perf_monitor 0.1.1
flutter_perf_monitor: ^0.1.1 copied to clipboard
Real-time performance monitoring with FPS tracking and memory usage for Flutter applications
Flutter Performance Monitor #
Real-time performance monitoring with FPS tracking and memory usage for Flutter applications.
Features #
- 🎯 Real-time FPS tracking - Monitor frame rates in real-time
- 💾 Memory usage monitoring - Track memory consumption patterns
- 📊 Performance metrics - Comprehensive performance analytics
- 🔄 Live updates - Real-time performance data updates
- 📱 Cross-platform - Works on iOS, Android, Web, and Desktop
- ⚡ Lightweight - Minimal performance impact on your app
- 🚀 Native implementations - Real CPU and memory metrics on Android/iOS
Getting Started #
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_perf_monitor: ^0.1.0
Usage #
import 'package:flutter_perf_monitor/flutter_perf_monitor.dart';
void main() {
// Initialize the performance monitor
FlutterPerfMonitor.initialize();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Column(
children: [
// Performance monitor widget
PerfMonitorWidget(),
// Your app content
Expanded(
child: YourAppContent(),
),
],
),
),
);
}
}
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 usagegetPerCoreCpuUsage()- Get per-core CPU usage percentages
PerfMonitorWidget #
A widget that displays performance metrics.
Example #
See the example directory for a complete working example.
Native Implementations #
This package includes native implementations for Android and iOS to provide accurate system-level metrics:
Android #
- Total & Available Memory: Via
ActivityManager.MemoryInfo - Per-Core CPU Usage: Via
/proc/stat - Total CPU Usage: Average of all cores
iOS #
- Total & Available Memory: Via
ProcessInfoandmach_task_basic_info - Per-Core CPU Usage: Via
task_threads - Total CPU Usage: Sum of all thread usage
Fallback Behavior #
On platforms without native support (Web, Desktop), the package falls back to:
- Memory: Process-level memory via
ProcessInfo.currentRss - CPU: FPS-based estimation
For detailed implementation information, see SETUP.md.
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.