Skip to content

The Lighthouse for Flutter Apps - A one-line integration performance monitoring plugin that overlays real-time performance metrics on your Flutter app.

License

Notifications You must be signed in to change notification settings

shariaralphabyte/flutter_perf_lens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฅ flutter_perf_lens

The Lighthouse for Flutter Apps - A one-line integration performance monitoring plugin that overlays real-time performance metrics on your Flutter app.

pub package License: MIT

โœจ Features

  • ๐ŸŽฏ One-line integration - Just wrap your app with PerfLens()
  • ๐Ÿ“Š Real-time FPS monitoring - See frame rate drops instantly
  • ๐Ÿง  Memory usage tracking - Monitor heap usage and GC activity
  • ๐ŸŒ Network call debugging - Track HTTP requests automatically
  • ๐Ÿ”„ Widget rebuild detection - Identify excessive rebuilds
  • ๐ŸŽจ Draggable overlay UI - Move and expand/collapse the monitor
  • ๐ŸŒ™ Theme support - Auto-adapts to light/dark themes
  • ๐Ÿ› Debug-only - Automatically disabled in release builds

๐Ÿš€ Quick Start

Installation

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

dependencies:
  flutter_perf_lens: ^1.0.0

Usage

Option 1: Wrap your entire app (Recommended)

import 'package:flutter/material.dart';
import 'package:flutter_perf_lens/flutter_perf_lens.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return PerfLens(
      child: MaterialApp(
        title: 'My App',
        home: HomePage(),
      ),
    );
  }
}

Option 2: Global monitoring

import 'package:flutter_perf_lens/flutter_perf_lens.dart';

void main() {
  FlutterPerfLens.enableGlobalMonitoring();
  runApp(MyApp());
}

That's it! ๐ŸŽ‰ You'll see a floating performance monitor overlay on your app.

๐Ÿ“ฑ How to Use the Overlay

  • Tap to expand/collapse detailed metrics
  • Drag to move the overlay around the screen
  • Green border = Good performance (FPS > 55)
  • Red border = Performance issues detected (FPS < 45)

Compact View

Shows just the FPS with a color-coded indicator.

Expanded View

Shows detailed metrics:

  • FPS - Frames per second
  • Memory - Current memory usage
  • Network - Number of network calls
  • Rebuilds - Widget rebuild count

๐Ÿ› ๏ธ Advanced Configuration

PerfLens(
  enabled: kDebugMode,           // Enable/disable monitoring
  showOverlay: true,             // Show/hide the overlay
  interceptNetwork: true,        // Enable network monitoring
  child: MyApp(),
)

๐ŸŽจ Custom Theming

PerfLens automatically adapts to your app's theme, but you can customize it:

import 'package:flutter_perf_lens/flutter_perf_lens.dart';

// The overlay will automatically use light/dark theme based on system
// No additional configuration needed!

๐Ÿ” Detecting Widget Rebuilds

Wrap specific widgets to monitor their rebuild frequency:

RebuildDetector(
  debugLabel: 'MyExpensiveWidget',
  child: MyExpensiveWidget(),
)

Excessive rebuilds (>10) will be logged to the console in debug mode.

๐Ÿ“Š Performance Metrics

FPS Monitoring

  • Uses SchedulerBinding.instance.addTimingsCallback
  • Calculates real-time frame rates
  • Color-coded indicators:
    • ๐ŸŸข Green: 55+ FPS (Smooth)
    • ๐ŸŸ  Orange: 45-54 FPS (Minor lag)
    • ๐Ÿ”ด Red: <45 FPS (Performance issues)

Memory Tracking

  • Monitors heap usage
  • Tracks garbage collection frequency
  • Helps identify memory leaks

Network Monitoring

  • Intercepts all HTTP calls using HttpOverrides
  • Counts requests automatically
  • No impact on network performance

Widget Rebuilds

  • Detects unnecessary widget rebuilds
  • Helps optimize widget trees
  • Debug console warnings for excessive rebuilds

๐ŸŽฏ Why PerfLens?

Every Flutter developer struggles with app performance, but learning DevTools can be overwhelming. PerfLens gives you instant visual feedback with zero learning curve.

Perfect for:

  • ๐Ÿš€ Rapid prototyping - Spot performance issues early
  • ๐Ÿ› Debugging - Visual feedback during development
  • ๐Ÿ“ˆ Optimization - Monitor improvements in real-time
  • ๐Ÿ‘ฅ Team collaboration - Share performance screenshots
  • ๐ŸŽ“ Learning - Understand Flutter performance patterns

๐Ÿ”ฎ Roadmap

  • Export Performance Reports - JSON/CSV summaries
  • Custom Alerts - Configurable performance thresholds
  • CI/CD Integration - Automated performance reports
  • Remote Dashboard - Desktop/web monitoring interface
  • Battery Impact Monitoring - Advanced power usage tracking
  • Custom Metrics - Plugin API for custom measurements

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • Inspired by Chrome DevTools Lighthouse
  • Built with โค๏ธ for the Flutter community
  • Special thanks to all contributors

Made with ๐Ÿ”ฅ by the Flutter community

If PerfLens helped you optimize your app, consider giving it a โญ on GitHub!

๐Ÿท๏ธ Tags

#Flutter #FlutterDev #PerformanceMonitoring #DevTools #MobileApp #AppOptimization #FPS #MemoryUsage #NetworkMonitoring #WidgetRebuild #FlutterPlugin #DeveloperTools #AppPerformance #Lighthouse #ChromeDevTools #FlutterCommunity #OpenSource #MIT #Debugging #Profiling #RealTimeMonitoring #UIPerformance #MobileDevelopment #CrossPlatform #DartLang #FlutterPackage #PubDev #GitHub #SoftwareDevelopment #CodeOptimization

About

The Lighthouse for Flutter Apps - A one-line integration performance monitoring plugin that overlays real-time performance metrics on your Flutter app.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published