console_plus 2.0.1
console_plus: ^2.0.1 copied to clipboard
A Flutter plugin that provides an elegant in-app developer console with floating button.
ConsolePlus #
A floating in-app console for Flutter β view, filter, search & export logs while your app runs!
console_plus lets you debug on-device with a floating overlay console that captures print(), debugPrint(), and developer.log() β in real time.
π Version 2.0.0 & 2.0.1 Highlights #
π Major Rewrite for Stability & Zone Safety
- π§ Zone-safe initialization β no more βZone mismatchβ errors.
- πͺ Unified log capture β
print()+debugPrint()+ platform errors all logged automatically. - π§© Cleaner API β single
ConsolePlus.initApp()entry point. - π¨ Redesigned console UI β smoother, resizable, searchable overlay.
- π§ͺ Better Flutter Test compatibility β works seamlessly inside test zones.
β¨ Features #
β
Floating draggable console overlay
β
Logs display above your appβs UI (non-blocking)
β
Captures print(), debugPrint(), and developer.log()
β
Auto-scroll when near the bottom
β
Filter logs by type (INFO, WARNING, ERROR)
β
Keyword search for tags or text
β
Copy, clear, and export logs as JSON
β
Built-in floating π debug button
β
Captures FlutterError and PlatformDispatcher errors
β
Compatible with Flutter 3.16+ / Dart 3+
βοΈ Installation #
Add to your pubspec.yaml:
dependencies:
console_plus: ^2.0.1
Then fetch packages:
flutter pub get
Import it:
import 'package:console_plus/console_plus.dart';
π» Usage #
Step 1 β Initialize ConsolePlus #
Wrap your app inside ConsolePlus.initApp():
Future<void> main() async {
await ConsolePlus.initApp(
const MyApp(),
interceptPrints: true, // Capture print() and debugPrint()
captureFlutterErrors: true, // Capture Flutter framework errors
capturePlatformErrors: true, // Capture platform dispatcher errors
);
}
π§ This ensures WidgetsFlutterBinding and runApp() are initialized in the same zone β no more zone mismatch errors!
Step 2 β Show Floating Debug Button #
FloatingDebugButton.show(context);
This shows a draggable π button that opens the console overlay.
Step 2 β Log Messages #
Use:
DebugLogConsole.log("User logged in successfully");
DebugLogConsole.log("Missing field: email", type: LogType.warning);
DebugLogConsole.log("API request failed", type: LogType.error);
Or just use:
print("Something happened");
debugPrint("App started!");
Both are automatically captured by ConsolePlus.
Step 3 β Export Logs #
Tap the β¬οΈ Download icon in the console header to export as a .json file.
You can also programmatically call:
final json = await DebugLogConsole.exportLogs(asJson: true);
ποΈ Console UI #
- π’ Floating, draggable, and resizable window
- π Search bar with keyword filtering
- π§© Filter by log levels (Info / Warning / Error)
- π Copy, β¬οΈ Export, ποΈ Clear logs
- π Persistent scroll + multi-line selection
- β‘ Real-time updates powered by ValueNotifier
π§© Example #
import 'package:flutter/material.dart';
import 'package:console_plus/console_plus.dart';
Future<void> main() async {
await ConsolePlus.initApp(
const MyApp(),
interceptPrints: true,
captureFlutterErrors: true,
capturePlatformErrors: true,
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'ConsolePlus Demo',
theme: ThemeData.dark(useMaterial3: true),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
int counter = 0;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback(
(_) => FloatingDebugButton.show(context),
);
}
void _generateLogs() {
counter++;
for (final type in ['Info', 'Warning', 'Error']) {
debugPrint('D $type log #$counter');
print('P $type log #$counter');
}
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('ConsolePlus Demo')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Button pressed $counter times'),
const SizedBox(height: 20),
ElevatedButton(
onPressed: _generateLogs,
child: const Text('Generate Logs'),
),
],
),
),
);
}
}
π File Export #
Format: .json
Example output:
[
{
"timestamp": "2025-11-08T12:30:01.345Z",
"type": "info",
"message": "App started"
},
{
"timestamp": "2025-11-08T12:31:14.123Z",
"type": "error",
"message": "Network timeout"
}
]
π§ Upgrading from v1.x β v2.0.1 #
Before:
void main() {
ConsolePlus.init(MyApp());
runApp(MyApp());
}
After (v2.0.0):
Future<void> main() async {
await ConsolePlus.initApp(
const MyApp(),
interceptPrints: true,
captureFlutterErrors: true,
capturePlatformErrors: true,
);
}
β ConsolePlus.init() β replaced with ConsolePlus.initApp() β Initialization now must be awaited β Zone-safe by default β fixes zone mismatch crashes β No more manual WidgetsFlutterBinding.ensureInitialized() calls required
Contributing #
PRs welcome. Keep debug-only behaviour intact. If you add native platform code, ensure release builds keep plugin inert unless explicitly enabled.
| Floating Button | Console Overlay | Search Filter |
|---|---|---|
![]() |
![]() |
![]() |
π License #
MIT License Β© 2025 Ashish
See the full LICENSE file for details.
π¬ Credits #
Built with β€οΈ by Ashish Follow for updates and Flutter dev tips!



