Skip to content

LiquidatorCoder/flutter_debug_tools

Repository files navigation

FlutterLens

In-app debug tools for Flutter UI, rendering, logs, navigation, and device diagnostics - no context switching required.

Platform Pub Package License: MIT

Features β€’ Installation β€’ Quick Start β€’ Debug Logs β€’ Tips β€’ License


Screenshots
Flow 1 Flow 2 Flow 3
🧲 Edge tray launcher docked to the right side; draggable and always accessible. 🧾 Version ticker displaying app, FlutterLens, Flutter, Dart, and build mode details. πŸ“‹ Bottom sheet tools grid with active/inactive visual states and quick toggles.
Flow 4 Flow 5 Flow 6
πŸ“± In-app debug logs to inspect console logs inside the running app. 🎨 Color result card showing selected color in HEX, RGB, and HSL with copy action. ⚑ Device details to quickly check and share device details.
Flow 7 Flow 8 Flow 9
πŸŽ›οΈ Animation toolbox with global speed, pause/disable toggles, frame timing HUD, and animated-region highlighting controls. πŸ“ˆ Frame timing HUD in context showing live FPS, average frame time, and max frame time over the app surface. 🌐 Network inspector list view with status filters, HTTP methods, durations, and retry markers for requests.
Flow 10 Β  Β 
πŸ”Ž Network request details sheet with URL, method, status, duration, and request/response headers for deep inspection. Β  Β 

✨ Features

  • 🧭 Screen Name Overlay: See the active route/screen while navigating.
  • πŸ“‹ Debug Logs Viewer: Capture and inspect console logs inside the running app.
  • 🌐 Network Inspector: Capture request/response timing, headers, payloads, failures, and retry attempts.
  • πŸ“± Device Details: Inspect model, OS, screen metrics, and hardware info in-app.
  • 🎯 Color Picker: Pick any on-screen pixel color quickly.
  • 🧱 Debug Paint / Layout Insights: Visualize layout boundaries and spacing behavior.
  • 🌈 Repaint Rainbow: Spot frequent repaints to detect expensive widgets.
  • πŸŽ›οΈ Animation Toolbox: Control animation speed, pause, disable animations, frame timing HUD, and animated-region highlights.
    • Includes global curve presets (for example: System, Linear, Ease In Out, Bounce Out, and more) for animations that opt into FlutterLens curve scope.
  • ⚑ Performance Overlay Toggle: Enable Flutter performance overlay directly from the panel.
  • 🧲 Edge Tray Launcher: Open FlutterLens from a draggable edge tray.
  • 🧾 Version Ticker: Live ticker for app/build/flutter/dart/FlutterLens versions.
  • 🎨 Picked Color Card: View HEX/RGB/HSL + copy from the panel.
  • πŸ’Ύ Sticky Debug Toggles: Core flags are persisted across launches.

🧰 Tool-by-tool quick map

  • Debug Paint β†’ toggles debugPaintSizeEnabled
  • Size Info β†’ enables render box inspector overlay
  • Repaint Rainbow β†’ toggles debugRepaintTextRainbowEnabled
  • Debug Logs β†’ opens in-app logs viewer
  • Network Inspector β†’ opens in-app request/response inspector
  • Perf Overlay β†’ toggles showPerformanceOverlay
  • Color Picker β†’ pixel pick + color card/copy flow
  • Device Details β†’ opens device info sheet
  • Screen Name β†’ route name overlay (with DebugNavigatorObserver)
  • Animation Toolbox β†’ animation speed/pause/disable/highlight controls

πŸ“¦ Installation

Add this to your pubspec.yaml:

dependencies:
  flutter_debug_tools: ^2.0.5

Then run:

flutter pub get

πŸš€ Quick Start

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

Future<void> main() async {
  await DebugLogCapture.runApp(() async {
    runApp(const MyApp());
  });
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    final navigatorObserver = DebugNavigatorObserver();

    return FlutterLens(
      builder: (context, showPerformanceOverlay, child) {
        return MaterialApp(
          title: 'FlutterLens Demo',
          showPerformanceOverlay: showPerformanceOverlay,
          navigatorObservers: [navigatorObserver],
          home: const Placeholder(),
        );
      },
    );
  }
}

🧩 Minimal integration (without log zone wrapper)

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return FlutterLens(
      builder: (context, showPerformanceOverlay, child) {
        return MaterialApp(
          showPerformanceOverlay: showPerformanceOverlay,
          home: const Placeholder(),
        );
      },
    );
  }
}

🎚️ Opt animations into global curve override

Animation Toolbox curve presets apply to animations that resolve their curve from FlutterLensAnimationCurveScope:

final curve = FlutterLensAnimationCurveScope.resolve(context, Curves.easeInOutCubic);

AnimatedContainer(
  duration: const Duration(milliseconds: 500),
  curve: curve,
  child: const Placeholder(),
)

πŸŽ›οΈ Disable in non-debug environments

FlutterLens(
  isEnabled: kDebugMode,
  builder: (context, showPerformanceOverlay, child) {
    return MaterialApp(
      showPerformanceOverlay: showPerformanceOverlay,
      home: const HomeScreen(),
    );
  },
)

🧾 Debug Logs (How It Works)

  • βœ… Captures Dart-side console logs (including print output in the wrapped zone)
  • βœ… Captures framework/platform error callbacks and shows them in the logs viewer
  • βœ… Lets you filter logs by level (All, Info, Warn, Error, Debug)
  • βœ… Tap any log row to copy it to clipboard

If you already use another logger, you can still use it; FlutterLens will continue showing captured console/error output in the viewer.

πŸ”Ž What gets captured

  • print(...) output (inside DebugLogCapture.runApp zone)
  • FlutterError.onError
  • PlatformDispatcher.instance.onError
  • uncaught zoned async exceptions

πŸ“š Public logging APIs

  • DebugLogCapture.install()
  • DebugLogCapture.runApp(() async { ... })
  • DebugLogStore.instance.add(...)
  • DebugLogStore.instance.clear()

🧭 Navigation integration

To populate route names in the Screen Name overlay, attach DebugNavigatorObserver:

MaterialApp(
  navigatorObservers: [DebugNavigatorObserver()],
  home: const HomeScreen(),
)

πŸ–±οΈ Panel interactions

  • Swipe down on the panel to dismiss.
  • Tap outside the panel to dismiss.
  • Drag the right-edge tray up/down to reposition.
  • Tap the tray to open FlutterLens.

🌐 Network Inspector coverage

  • Captures requests made through dart:io HttpClient (including typical package:http usage on Android/iOS/desktop).
  • Does not capture web fetch/XHR traffic.

πŸ’‘ Tips

  • Use FlutterLens only in debug/dev environments.
  • Add DebugNavigatorObserver for better route visibility in overlays.
  • Keep an eye on Repaint Rainbow + Performance Overlay together for quick perf diagnosis.
  • Use FlutterLensAnimationCurveScope.resolve(...) in your app animations when you want Animation Toolbox curve overrides to affect them.
  • Network Inspector currently targets dart:io HttpClient traffic.
  • If Dart/Flutter versions show fallback values, pass build-time dart-defines for those keys.

πŸ™Œ Credits

Built with:


🐞 Bugs or Requests


πŸ“„ License

MIT License

About

In-app debug tools for Flutter UI, rendering, logs, navigation, and device diagnostics - no context switching required.

Topics

Resources

License

Stars

Watchers

Forks

Contributors