flutter_debug_tools 2.0.0
flutter_debug_tools: ^2.0.0 copied to clipboard
FlutterLens is a set of tools to help find and debug UI or performance issues from the Flutter app itself.
FlutterLens ๐
[FlutterLens Branding]
In-app debug tools for Flutter UI, rendering, logs, navigation, and device diagnostics - no context switching required.
Features โข Installation โข Quick Start โข Debug Logs โข Tips โข License
| Screenshots | ||
|---|---|---|
| [Flow 1] | [Flow 3] | [Flow 5] |
| ๐งฒ Edge tray launcher docked to the right side; draggable and always accessible. | ๐ Bottom sheet tools grid with active/inactive visual states and quick toggles. | ๐จ Color result card showing selected color in HEX, RGB, and HSL with copy action. |
| [Flow 2] | [Flow 4] | [Flow 6] |
| ๐งพ Version ticker displaying app, FlutterLens, Flutter, Dart, and build mode details. | ๐ฑ In-app debug logs to inspect console logs inside the running app. | โก Device details to quickly check and share device details. |
โจ Features #
- ๐งญ Screen Name Overlay: See the active route/screen while navigating.
- ๐ Debug Logs Viewer: Capture and inspect console logs inside the running app.
- ๐ฑ 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.
- โก 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โ togglesdebugPaintSizeEnabledSize Infoโ enables render box inspector overlayRepaint Rainbowโ togglesdebugRepaintTextRainbowEnabledDebug Logsโ opens in-app logs viewerPerf Overlayโ togglesshowPerformanceOverlayColor Pickerโ pixel pick + color card/copy flowDevice Detailsโ opens device info sheetScreen Nameโ route name overlay (withDebugNavigatorObserver)
๐ฆ Installation #
Add this to your pubspec.yaml:
dependencies:
flutter_debug_tools: ^2.0.0
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(),
);
},
);
}
}
๐๏ธ 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
printoutput 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 (insideDebugLogCapture.runAppzone)FlutterError.onErrorPlatformDispatcher.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.
๐ก Tips #
- Use FlutterLens only in debug/dev environments.
- Add
DebugNavigatorObserverfor better route visibility in overlays. - Keep an eye on
Repaint Rainbow+Performance Overlaytogether for quick perf diagnosis. - If Dart/Flutter versions show fallback values, pass build-time dart-defines for those keys.
๐ Credits #
Built with:
๐ Bugs or Requests #
- Bug report: Open issue
- Feature request: Open request
- PRs are welcome! ๐
๐ License #
MIT License