-
Notifications
You must be signed in to change notification settings - Fork 3
Usage
void main() {
ZeroInspectorKit.runAppWithInspector(const MyApp());
}This method:
- Auto-initializes inspector / 自动初始化检查器
- Captures
print()via Zone / 通过 Zone 捕获 print() - Displays floating button via Overlay / 通过 Overlay 显示悬浮按钮
- Auto-injects route observer / 自动注入路由观察者
void main() {
ZeroInspectorKit.init();
runApp(ZeroInspectorKit.wrapApp(const MyApp()));
}The inspector panel contains 6 tabs:
检查器面板包含 6 个标签页:
| Tab | Icon | Feature |
|---|---|---|
| Network | 🌐 | HTTP request viewing + interceptor rules / 网络请求查看 + 拦截修改 |
| Logs | 📝 | Log viewing with level filter / 日志查看 |
| Database | 💾 | Database and table inspection / 数据库查看 |
| Routes | 🧭 | Route navigation tracking / 路由追踪 |
| Memory | 📊 | Memory trend, Dart Heap, Native memory, leak detection / 内存趋势、Dart Heap、Native 内存、泄漏检测 |
| FPS | 🎯 | Real-time FPS, jank rate, trend chart / 实时 FPS、卡顿率、趋势图 |
The Memory and FPS panels are off by default to avoid performance overhead. Toggle the switch at the top of each panel to start collecting data.
Memory 和 FPS 面板默认关闭以避免性能开销。在各自面板顶部打开开关才会开始采集数据。
- The floating button appears after 1 second delay / 悬浮按钮延迟 1 秒出现
- Drag to move it along the screen edge / 拖动 可沿屏幕边缘移动
- Tap (when fully visible) to open/close the inspector panel / 点击(完全可见时)打开/关闭检查器面板
- Button auto-snaps to the nearest screen edge / 按钮自动吸附到最近的屏幕边缘
- Breathing animation when idle / 空闲时有呼吸动画
When released near a screen edge, the button auto-docks and tucks into the edge, leaving only a 24px peek visible:
拖动松手后,按钮会自动吸附到最近边缘并"收入"边缘,仅露出 24px 小弧边:
| State | Behavior / 行为 |
|---|---|
| Docked (tucked in) | Only 24px peek visible; icon becomes a directional chevron (left dock → ➡, right dock → ⬅) hinting at tap-to-pull-out / 仅露出 24px;图标变为方向箭头提示可点击拉出 |
| Tap docked peek | Smoothly pulls out to fully visible (panel NOT opened, avoids accidental open) / 平滑拉出到完全可见(不打开面板,避免误触) |
| Tap fully visible | Opens the inspector panel / 打开检查器面板 |
This design avoids conflicts with system back gestures (Android/iOS edge swipe to go back) when pulling out from the docked state.
此设计避免了从吸附态拖出时与系统返回手势(Android/iOS 边缘右滑退出)的冲突。
All three main viewers (Network, Logs, Database) support fuzzy search:
三大查看器均支持模糊搜索:
| Viewer | Search Scope |
|---|---|
| Network | URL, HTTP method / URL、请求方法 |
| Logs | Message, tag / 消息、标签 |
| Database (global) | Database name, table name / 数据库名、表名 |
| Database (in-database) | Table name, all column data / 表名、所有列数据 |
The inspector auto-captures print() output. You can also use manual log methods for precise level control:
检查器会自动捕获 print() 输出。也可以使用手动日志方法进行精确级别控制:
Quick shorthand (recommended) / 简化写法(推荐):
InspectorLog.v('Verbose log / 详细日志');
InspectorLog.d('Debug log / 调试日志');
InspectorLog.i('Info log / 信息日志');
InspectorLog.w('Warning log / 警告日志');
InspectorLog.e('Error log / 错误日志');Full form / 完整写法:
InspectorLogInterceptor.instance.verbose('Verbose log / 详细日志');
InspectorLogInterceptor.instance.debug('Debug log / 调试日志');
InspectorLogInterceptor.instance.info('Info log / 信息日志');
InspectorLogInterceptor.instance.warning('Warning log / 警告日志');
InspectorLogInterceptor.instance.error('Error log / 错误日志');No configuration needed! The plugin automatically captures logs from third-party logging libraries (e.g., logger, flutter_logger) that use print() or debugPrint().
无需配置! 插件会自动捕获所有使用 print() 的第三方日志库的日志。
These logs are categorized as INFO level.
这些日志统一归类为 INFO 级别。
To sync inspector-captured logs to your third-party logger:
将检查器捕获的日志同步到第三方日志库:
InspectorLogInterceptor.instance.onLogCaptured = (entry) {
yourLogger.log(entry.message);
};- Network Inspector — Network request details + interceptor rules / 网络检查器详情 + 拦截修改
- Log Viewer — Log viewing details / 日志查看器详情
- Database Viewer — Database inspection details / 数据库查看器详情
- Route Tracker — Route tracking details / 路由追踪详情
- Memory Viewer — Memory monitoring & leak detection / 内存监控与泄漏检测
- FPS Viewer — FPS monitoring & jank detection / FPS 监控与卡顿检测