From bc0210cde07c4384ef8458d5f57b36b3642cecea Mon Sep 17 00:00:00 2001 From: AmisKwok Date: Wed, 30 Sep 2026 08:40:57 +0800 Subject: [PATCH 1/5] fix: bump to 1.14.0 and fix leaks, capture edge cases and masking gaps --- CHANGELOG.md | 18 ++ README.md | 6 +- README_zh.md | 6 +- docs/404.html | 2 +- docs/404/index.html | 2 +- docs/Alerts/index.html | 4 +- docs/Configuration/index.html | 4 +- docs/Custom-Database-Provider/index.html | 4 +- docs/Database-Viewer/index.html | 4 +- docs/Errors/index.html | 4 +- docs/FAQ/index.html | 4 +- docs/FPS-Viewer/index.html | 4 +- docs/Getting-Started/index.html | 4 +- docs/Installation/index.html | 8 +- docs/Log-Viewer/index.html | 4 +- docs/Memory-Viewer/index.html | 4 +- docs/Network-Inspector/index.html | 4 +- docs/Route-Tracker/index.html | 4 +- docs/Timeline/index.html | 4 +- docs/Usage/index.html | 4 +- .../_buildManifest.js | 2 +- .../_ssgManifest.js | 0 .../static/chunks/nextra-data-en-US.json | 2 +- ...c5.js => Installation-451e2c8dbda34e0e.js} | 2 +- docs/index.html | 4 +- ios/zero_inspector_kit.podspec | 2 +- lib/src/interceptors/dio_interceptor.dart | 51 ++++- .../interceptors/inspector_http_client.dart | 19 +- .../inspector_response_proxy.dart | 135 +++++++++++- lib/src/interceptors/log_interceptor.dart | 11 +- lib/src/interceptors/route_observer.dart | 7 +- lib/src/models/network_request.dart | 25 ++- lib/src/services/alert_service.dart | 37 +++- lib/src/services/fps_service.dart | 12 +- lib/src/services/inspector_service.dart | 21 +- .../services/memory_inspector_service.dart | 194 ++++++++++++++---- lib/src/services/persistence_service.dart | 20 ++ lib/src/services/ws_inspector_service.dart | 28 ++- lib/src/utils/environment.dart | 16 +- lib/src/utils/inspector_version.dart | 2 +- lib/src/utils/sensitive_data.dart | 115 ++++++++--- pubspec.yaml | 2 +- 42 files changed, 637 insertions(+), 168 deletions(-) rename docs/_next/static/{rhZ5TDhK5xNMS7pIlRbZf => 4hyj41opBQbKAj5dw70NM}/_buildManifest.js (96%) rename docs/_next/static/{rhZ5TDhK5xNMS7pIlRbZf => 4hyj41opBQbKAj5dw70NM}/_ssgManifest.js (100%) rename docs/_next/static/chunks/pages/{Installation-048a2c75d4cde1c5.js => Installation-451e2c8dbda34e0e.js} (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 039e6ad..449ba13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 1.14.0 + +### Fixed / 修复 +- 修复内存泄漏追踪的若干隐患:`_trackedRecords` 改为按优先级 `leaked > verifying > tracking > released` 级联淘汰最旧者,封住此前仅删 `released`、其余状态无界增长的内存风险(release / 真机无 VM Service 时 `verifying` 记录尤其会堆积);VM Service WebSocket 增加“连接中”并发保护避免重复建连泄漏;内存刷新增加重入守卫。追踪 ID 仍沿用 `identityHashCode` 以兼容公开 API 与既有测试。 / Fixed several memory-leak tracking issues: `_trackedRecords` now evicts oldest entries by priority `leaked > verifying > tracking > released`, closing the previous unbounded-growth hole where only `released` was trimmed (verifying records piled up especially on release / real-device without VM Service); guarded the VM Service WebSocket against concurrent reconnect leaks; added a reentrancy guard to the memory refresh. The tracking id stays `identityHashCode` to keep the public API and existing tests stable. +- 修复资源泄漏:`InspectorService.notifyThrottled` 的兜底 Timer 改为可取消(避免瞬时堆积大量 Timer);`WsInspectorService` 重复 `close` 去重;`LogInterceptor` 在 `FlutterError.onError` 原本为 null 时正确恢复。 / Fixed resource leaks: made the throttle fallback `Timer` cancelable (avoids transient piles of timers); de-duplicated `WsInspectorService` double-close; restored `FlutterError.onError` to null when it was originally null. +- 修复 `AlertService` 节流 key 含易变数值导致 1s 冷却失效的问题(key 改为 `source + rule.id`)。 / Fixed `AlertService` throttle key containing volatile numbers that defeated the 1s cooldown (key is now `source + rule.id`). +- 修复 `PersistenceService.init` 并发穿透导致重复 `openDatabase`(旧句柄泄漏),改用 `_initFuture` 串行化。 / Fixed `PersistenceService.init` concurrent re-entry opening two databases (leaking the old handle) by serializing via `_initFuture`. +- 修复 Dio 抓包:无响应(超时/网络错)时以 `statusCode: -1` 占位避免请求永挂“进行中”;`responseType: stream` 不再持有未关闭的 `ResponseBody`(socket 泄漏),`bytes` 时按预览上限截断。 / Fixed Dio capture: a timeout/no-response now gets a `statusCode: -1` placeholder instead of hanging forever; `responseType: stream` no longer holds an unclosed `ResponseBody` (socket leak), and `bytes` is truncated to the preview cap. +- 修复路由 id 用毫秒时间戳会碰撞(`didPush`+`didReplace` 同毫秒),改用全局自增计数器。 / Fixed route id collisions from millisecond timestamps by switching to a global auto-increment counter. +- 修复拦截规则“修改响应头”静默不生效(`responseHeaders` 仅定义未应用);HTTP client 仅按 `443/8443` 猜 scheme 会误判其它 TLS 端口为 http,并转发真实的 `connectionInfo`。 / Fixed interceptor rules' response-header rewrite being silently ignored; the HTTP client now infers scheme beyond just `443/8443` and forwards the real `connectionInfo`. +- 修复 `inspector_response_proxy` gzip 解压后 `contentLength` 仍以压缩前长度下发导致面板字节数偏差。 / Fixed `contentLength` after gzip decompression still reporting the pre-compression length. +- 修复 `environment.isInspectorEnabled` 在 debug 下 `--dart-define=INSPECTOR_ENABLED=false` 失效(改用 `String.fromEnvironment` 区分“未设置 vs false”)。 / Fixed `environment.isInspectorEnabled` ignoring `--dart-define=INSPECTOR_ENABLED=false` in debug by using `String.fromEnvironment`. + +### Changed / 优化 +- 敏感数据脱敏加固:失败不再原样回退(fail-open)而是保守脱敏;支持 JSON key 的 Unicode 转义(`\u0077` 等)反转义后匹配;敏感键值为对象/数组时也递归脱敏;Bearer 正则覆盖 `:` 等字符;新增手机号/身份证号 PII 正则。 / Hardened sensitive-data masking: no longer falls back to the original body on error; supports Unicode-unescaped JSON keys; recurses into object/array values; widens the Bearer regex; adds phone/ID PII patterns. +- 性能:FPS 帧列表改用 `ListQueue` 消除每帧 O(n) 搬移;WS 会话 body 汇总降频到 10Hz;存储统计增加防重入。 / Perf: FPS frame list uses `ListQueue` to remove per-frame O(n) shifts; WS session body aggregation is throttled to 10Hz; storage stats gained re-entrancy protection. +- `InspectorService.maxBodyPreviewBytes` 单位由“UTF-16 字符”改为真实字节,避免中文 / gzip base64 场景低估约 2-3 倍预算。 / `InspectorService.maxBodyPreviewBytes` now counts real bytes instead of UTF-16 chars, avoiding ~2-3x under-budgeting for CJK / gzip base64. + ## 1.13.0 ### Changed / 优化 diff --git a/README.md b/README.md index 319c07d..d43eb5b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ An in-app developer console for Flutter: inspect HTTP, WebSocket & gRPC traffic, [![Dart](https://img.shields.io/badge/Dart-✓-0175C2?logo=dart)](https://dart.dev) [![Style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://pub.dev/packages/effective_dart) -> **🔔 Upgrade recommended:** This release trims large request/response bodies before UTF-8 decoding, so the inspector no longer decodes a 512 KB body just to keep the first 32K characters of the preview — up to ~16x less decoding work for ASCII payloads, with preview content unchanged. All users are encouraged to upgrade to the latest version (`^1.13.0`). +> **🔔 Upgrade recommended:** This release fixes a batch of resource-leak and correctness issues across the inspector: unreleased UI controllers/scroll positions, a duplicated WebSocket connection, double-closed WS sessions, a broken alert throttle, persistence double-init, memory-leak tracking mis-keying, plus Dio failure/stream edge cases and sensitive-data masking gaps. All users are encouraged to upgrade to the latest version (`^1.14.0`). 🌐 **[Official Website](https://www.zerolabsco.com/)**  ·  📦 **[View on pub.dev](https://pub.dev/packages/zero_inspector_kit)**  ·  🔗 **[View on GitHub](https://github.com/zero-labsco/zero_inspector_kit)** @@ -102,7 +102,7 @@ An in-app developer console for Flutter: inspect HTTP, WebSocket & gRPC traffic, ```yaml dependencies: - zero_inspector_kit: ^1.13.0 + zero_inspector_kit: ^1.14.0 ``` ### GitHub @@ -112,7 +112,7 @@ dependencies: zero_inspector_kit: git: url: https://github.com/zero-labsco/zero_inspector_kit.git - ref: release/v1.13.0 # replace 1.13.0 with the version you need + ref: release/v1.14.0 # replace 1.14.0 with the version you need ``` --- diff --git a/README_zh.md b/README_zh.md index 7db8d5e..7af601d 100644 --- a/README_zh.md +++ b/README_zh.md @@ -19,7 +19,7 @@ [![Dart](https://img.shields.io/badge/Dart-✓-0175C2?logo=dart)](https://dart.dev) [![Style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://pub.dev/packages/effective_dart) -> **🔔 推荐升级:** 本版本在大体积请求 / 响应体解码前先做剪枝,不再为了保留面板预览的前 32K 字符而完整解码 512 KB 的 body —— 纯 ASCII 载荷的解码量最多降到约 1/16,预览内容完全不变。建议所有用户升级到最新版本(`^1.13.0`)。 +> **🔔 推荐升级:** 本版本修复了一批检查器内的资源泄漏与正确性问题:未释放的 UI 控制器 / 滚动位置、重复的 WebSocket 连接、重复关闭的 WS 会话、失效的告警节流、持久化重复初始化、泄漏追踪的 key 冲突,以及 Dio 失败 / stream 边界、敏感数据脱敏缺口等。建议所有用户升级到最新版本(`^1.14.0`)。 🌐 **[官方网站](https://www.zerolabsco.com/)**  ·  📦 **[在 pub.dev 查看](https://pub.dev/packages/zero_inspector_kit)**  ·  🔗 **[查看 GitHub 仓库](https://github.com/zero-labsco/zero_inspector_kit)** @@ -101,7 +101,7 @@ ```yaml dependencies: - zero_inspector_kit: ^1.13.0 + zero_inspector_kit: ^1.14.0 ``` ### GitHub @@ -111,7 +111,7 @@ dependencies: zero_inspector_kit: git: url: https://github.com/zero-labsco/zero_inspector_kit.git - ref: release/v1.13.0 # 将 1.13.0 替换为你需要的版本号 + ref: release/v1.14.0 # 将 1.14.0 替换为你需要的版本号 ``` --- diff --git a/docs/404.html b/docs/404.html index d07050c..1d6aa25 100644 --- a/docs/404.html +++ b/docs/404.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/docs/404/index.html b/docs/404/index.html index d07050c..1d6aa25 100644 --- a/docs/404/index.html +++ b/docs/404/index.html @@ -1 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/docs/Alerts/index.html b/docs/Alerts/index.html index 5411ec1..17b92cf 100644 --- a/docs/Alerts/index.html +++ b/docs/Alerts/index.html @@ -1,4 +1,4 @@ -
🔔 Alerts

Alerts / 告警系统

+
🔔 Alerts

Alerts / 告警系统

Overview / 概述

Available since v1.3.0

@@ -62,4 +62,4 @@

Alerts are evaluated in-process and shown in the developer console only; they do not send data off-device / 告警仅在本机开发者控制台内评估与展示,不会将数据发送到设备外
  • Persisted to disk (since v1.11.0): triggered alerts are flushed to the SQLite ring buffer and replay into the Alerts tab after an app restart, and are included in the session archive export / 已落盘持久化(v1.11.0 起):已触发的告警会写入 SQLite 环形缓冲,重启后回放至 Alerts 标签页,并包含在会话存档导出中
  • The alert system is tree-shaken out in release builds, like the rest of the inspector / 与检查器其余部分一样,告警系统在 release 构建中被 tree-shake 移除
  • -


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Configuration/index.html b/docs/Configuration/index.html index aad7c5b..c29ab9f 100644 --- a/docs/Configuration/index.html +++ b/docs/Configuration/index.html @@ -1,4 +1,4 @@ -
    ⚙️ Configuration

    Configuration / 配置说明

    +
    ⚙️ Configuration

    Configuration / 配置说明

    ZeroInspectorKit.init() Parameters / 初始化参数

    @@ -567,4 +567,4 @@

    PropertyTypeDescriptionisRunningboolWhether monitoring is currently active / 是否正在监控currentFpsdoubleCurrent FPS (updated every 500ms) / 当前 FPS(每 500ms 更新)jankRatedoubleJank rate as percentage / 卡顿率(百分比)totalFrameCountintTotal frames captured / 总帧数totalJankyCountintTotal janky frames (>16ms) / 总卡顿帧数(>16ms)lastFrameJankyboolWhether the most recent frame was janky / 最近一帧是否卡顿fpsHistoryList<double>Recent 60 FPS values (unmodifiable) / 最近 60 个 FPS 值(不可变)frameRecordsList<FrameRecord>Recent frame records (unmodifiable, up to 3600) / 最近帧记录(不可变,最多 3600 条)

    See FPS Viewer for full feature details.

    -

    完整功能详情见 FPS Viewer。


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    完整功能详情见 FPS Viewer。


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Custom-Database-Provider/index.html b/docs/Custom-Database-Provider/index.html index 84ccf5a..37ba5af 100644 --- a/docs/Custom-Database-Provider/index.html +++ b/docs/Custom-Database-Provider/index.html @@ -1,4 +1,4 @@ -
    🔌 Custom Database Provider

    Custom Database Provider / 自定义数据库提供者

    +
    🔌 Custom Database Provider

    Custom Database Provider / 自定义数据库提供者

    Overview / 概述

    Zero Inspector Kit supports extending database inspection beyond SQLite through the DatabaseProvider interface.

    Zero Inspector Kit 通过 DatabaseProvider 接口支持扩展数据库检查功能到 SQLite 以外的数据库。

    @@ -129,4 +129,4 @@

    插件内置 SqliteDatabaseProvider,当 enableDatabaseScan 为 true(默认)时自动注册。

    You can also register it manually:

    也可以手动注册:

    -
    DatabaseRegistry.instance.registerProvider(SqliteDatabaseProvider());


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +
    DatabaseRegistry.instance.registerProvider(SqliteDatabaseProvider());

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Database-Viewer/index.html b/docs/Database-Viewer/index.html index 08d1320..80a4729 100644 --- a/docs/Database-Viewer/index.html +++ b/docs/Database-Viewer/index.html @@ -1,4 +1,4 @@ -
    💾 Database Viewer

    Database Viewer / 数据库查看器

    +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    对于非 SQLite 数据库,请参阅 自定义数据库提供者。


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Errors/index.html b/docs/Errors/index.html index 6e8e594..bf1fcb7 100644 --- a/docs/Errors/index.html +++ b/docs/Errors/index.html @@ -1,4 +1,4 @@ -
    🚨 Errors

    Errors / 异常聚合查看器

    +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/FAQ/index.html b/docs/FAQ/index.html index 7872b8a..fa28596 100644 --- a/docs/FAQ/index.html +++ b/docs/FAQ/index.html @@ -1,4 +1,4 @@ -
    ❓ FAQ

    FAQ / 常见问题

    +
    ❓ FAQ

    FAQ / 常见问题

    General / 通用

    Q: Does the inspector affect production builds? / 检查器会影响生产构建吗?

    A: No. The inspector is automatically disabled in release mode via kReleaseMode. Flutter’s tree-shaking removes all inspector-related code from production builds. You don’t need to remove any code.

    @@ -132,4 +132,4 @@

    可以。本项目采用 MPL-2.0 许可证,可用于闭源商业 App——未修改直接使用时无需公开任何源码;若修改了插件源文件,被修改的文件必须以 MPL-2.0 公开源码(你自己的 App 仍无需开源)。

    Q: Are you liable for issues in modified versions? / 修改版出问题你们负责吗?

    A: This plugin is provided “as is”, without warranty of any kind. The author assumes no responsibility or liability for the functionality, security, or any consequences arising from the use of modified versions or derivative projects.

    -

    本插件按”原样”提供,不提供任何担保。作者不对修改版或衍生项目的功能、安全性及任何使用后果承担责任。


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    本插件按”原样”提供,不提供任何担保。作者不对修改版或衍生项目的功能、安全性及任何使用后果承担责任。


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/FPS-Viewer/index.html b/docs/FPS-Viewer/index.html index 16bfc22..dbd16a0 100644 --- a/docs/FPS-Viewer/index.html +++ b/docs/FPS-Viewer/index.html @@ -1,4 +1,4 @@ -
    🎯 FPS Viewer

    FPS Viewer / FPS 监控面板

    +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Getting-Started/index.html b/docs/Getting-Started/index.html index 6b4ec52..c03cacf 100644 --- a/docs/Getting-Started/index.html +++ b/docs/Getting-Started/index.html @@ -1,4 +1,4 @@ -
    🚀 Getting Started

    Getting Started / 快速开始

    +
    🚀 Getting Started

    Getting Started / 快速开始

    Quick Start / 快速开始

    Integrate with just 1 line of code:

    仅需 1 行代码 即可完成集成:

    @@ -88,4 +88,4 @@

    Installation — Detailed installation methods / 详细安装方式
  • Usage — Full usage guide / 完整使用指南
  • Configuration — Configuration options / 配置选项
  • -


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Installation/index.html b/docs/Installation/index.html index 5cf3a62..17153d5 100644 --- a/docs/Installation/index.html +++ b/docs/Installation/index.html @@ -1,9 +1,9 @@ -
    📦 Installation

    Installation / 安装

    +

    Then run:

    然后运行:

    flutter pub get
    @@ -14,7 +14,7 @@

    zero_inspector_kit: git: url: https://github.com/zero-labsco/zero_inspector_kit.git - ref: release/v1.13.0

    + ref: release/v1.14.0

    Platform Setup / 平台配置

    Android

    No additional configuration needed.

    @@ -47,4 +47,4 @@

  • Getting Started — Quick start guide / 快速开始
  • Usage — Full usage guide / 完整使用指南
  • -


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +
    🚀 Getting Started📖 Usage
    \ No newline at end of file diff --git a/docs/Log-Viewer/index.html b/docs/Log-Viewer/index.html index 1e21b79..62c3f54 100644 --- a/docs/Log-Viewer/index.html +++ b/docs/Log-Viewer/index.html @@ -1,4 +1,4 @@ -
    📝 Log Viewer

    Log Viewer / 日志查看器

    +
    📝 Log Viewer

    Log Viewer / 日志查看器

    Overview / 概述

    The Log Viewer automatically captures logs from multiple sources with zero configuration.

    日志查看器自动从多个来源捕获日志,无需配置。

    @@ -162,4 +162,4 @@

    Starting the Log Interceptor / 启动日志拦截器

    If using runAppWithInspector(), the log interceptor starts automatically. Otherwise:

    如果使用 runAppWithInspector(),日志拦截器会自动启动。否则:

    -
    InspectorLogInterceptor.instance.start();

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +
    InspectorLogInterceptor.instance.start();

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Memory-Viewer/index.html b/docs/Memory-Viewer/index.html index a2c98c8..54b2769 100644 --- a/docs/Memory-Viewer/index.html +++ b/docs/Memory-Viewer/index.html @@ -1,4 +1,4 @@ -
    📊 Memory Viewer

    Memory Viewer / 内存监控面板

    +
    📊 Memory Viewer

    Memory Viewer / 内存监控面板

    The Memory Viewer provides comprehensive in-app memory analysis, including trend charts, Dart Heap details, Native memory breakdown, memory leak detection, image cache monitoring, and storage statistics.

    内存监控面板提供应用内全面内存分析,包括趋势图、Dart Heap 详情、Native 内存分项、内存泄漏检测、图片缓存监控和存储统计。

    @@ -262,4 +262,4 @@

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Network-Inspector/index.html b/docs/Network-Inspector/index.html index b9cfcfd..31aff05 100644 --- a/docs/Network-Inspector/index.html +++ b/docs/Network-Inspector/index.html @@ -1,4 +1,4 @@ -
    🌐 Network Inspector

    Network Inspector / 网络检查器

    +
    🌐 Network Inspector

    Network Inspector / 网络检查器

    Overview / 概述

    The Network Inspector automatically captures all HTTP requests made via the http package and Dio, with zero configuration needed.

    网络检查器自动捕获所有通过 http 包 和 Dio 发送的 HTTP 请求,无需任何配置。

    @@ -330,4 +330,4 @@

    Create / edit / delete rules / 创建 / 编辑 / 删除规则
  • Enable / disable individual rules / 启用 / 禁用单条规则
  • View rule status indicators in the request list / 在请求列表中查看规则状态标识
  • -


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Route-Tracker/index.html b/docs/Route-Tracker/index.html index 257783b..e2a41bb 100644 --- a/docs/Route-Tracker/index.html +++ b/docs/Route-Tracker/index.html @@ -1,4 +1,4 @@ -
    🧭 Route Tracker

    Route Tracker / 路由追踪

    +
    🧭 Route Tracker

    Route Tracker / 路由追踪

    Overview / 概述

    The Route Tracker monitors navigation history, recording all route push, pop, and replacement events.

    路由追踪器监控导航历史,记录所有路由 push、pop 和替换事件。

    @@ -62,4 +62,4 @@

    MaterialApp(
       navigatorObservers: [InspectorRouteObserver()],
       home: MyHomePage(),
    -)


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +)
    💾 Database Viewer🧵 Timeline
    \ No newline at end of file diff --git a/docs/Timeline/index.html b/docs/Timeline/index.html index e3c081a..91dd494 100644 --- a/docs/Timeline/index.html +++ b/docs/Timeline/index.html @@ -1,4 +1,4 @@ -
    🧵 Timeline

    Timeline / 统一会话时间线

    +
    🧵 Timeline

    Timeline / 统一会话时间线

    Overview / 概述

    The Timeline tab merges network, logs, errors, routes, and alerts into a single time-ordered stream, so you can see the full causal chain of a session at a glance — e.g. “route push → two requests → error log → 5xx alert”. Each source keeps its own data; the Timeline view only merges them for display.

    统一会话时间线把网络、日志、异常、路由、告警归并为一条按时间排序的流,让你一眼看清一次会话的完整因果链——例如「路由跳转 → 两个请求 → error 日志 → 5xx 告警」。各来源的数据仍归属各自服务,时间线视图只做归并显示。

    @@ -41,4 +41,4 @@

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/Usage/index.html b/docs/Usage/index.html index 9407342..a85ee48 100644 --- a/docs/Usage/index.html +++ b/docs/Usage/index.html @@ -1,4 +1,4 @@ -
    📖 Usage

    Usage / 使用指南

    +
    📖 Usage

    Usage / 使用指南

    Integration Methods / 集成方式

    void main() {
    @@ -207,4 +207,4 @@ 

    Session Persistence / 会话持久化

    Logs, network requests, and aggregated errors are asynchronously flushed to a local SQLite ring buffer. On the next launch, logs and aggregated errors replay into their tabs; network requests stay archived on disk for later export. Data therefore survives app restarts even if the inspector panel was never opened. Tap the storage icon in the panel header to open the Persisted data manager: view row counts per category, export the full session archive, or clear the disk. See Configuration (PersistenceService section) for the API and tuning parameters.

    -

    日志、网络请求与聚合异常会被异步写入本地 SQLite 环形缓冲。下次启动时,日志与聚合异常会回放入各自标签页;网络请求保留在磁盘存档,供之后导出。因此即使从未打开过检查器面板,数据也能跨重启保留。点击面板头部的存储图标可打开 Persisted data 管理弹层:查看各类别行数、导出完整会话存档或清空磁盘。API 与调参详见 Configuration(PersistenceService 一节)。


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    日志、网络请求与聚合异常会被异步写入本地 SQLite 环形缓冲。下次启动时,日志与聚合异常会回放入各自标签页;网络请求保留在磁盘存档,供之后导出。因此即使从未打开过检查器面板,数据也能跨重启保留。点击面板头部的存储图标可打开 Persisted data 管理弹层:查看各类别行数、导出完整会话存档或清空磁盘。API 与调参详见 Configuration(PersistenceService 一节)。


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/docs/_next/static/rhZ5TDhK5xNMS7pIlRbZf/_buildManifest.js b/docs/_next/static/4hyj41opBQbKAj5dw70NM/_buildManifest.js similarity index 96% rename from docs/_next/static/rhZ5TDhK5xNMS7pIlRbZf/_buildManifest.js rename to docs/_next/static/4hyj41opBQbKAj5dw70NM/_buildManifest.js index 00b925d..23caba4 100644 --- a/docs/_next/static/rhZ5TDhK5xNMS7pIlRbZf/_buildManifest.js +++ b/docs/_next/static/4hyj41opBQbKAj5dw70NM/_buildManifest.js @@ -1 +1 @@ -self.__BUILD_MANIFEST=function(e){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[e,"static/chunks/pages/index-09093d7a1b2e97fb.js"],"/Alerts":[e,"static/chunks/pages/Alerts-a070cfa208c3ff82.js"],"/Configuration":[e,"static/chunks/pages/Configuration-59d63292bf84e213.js"],"/Custom-Database-Provider":[e,"static/chunks/pages/Custom-Database-Provider-bbe4c3db5859578c.js"],"/Database-Viewer":[e,"static/chunks/pages/Database-Viewer-bae8bb7c99f3f2a2.js"],"/Errors":[e,"static/chunks/pages/Errors-3214b059d0e33517.js"],"/FAQ":[e,"static/chunks/pages/FAQ-09aca322a5a031c7.js"],"/FPS-Viewer":[e,"static/chunks/pages/FPS-Viewer-954be0ba8ec208c8.js"],"/Getting-Started":[e,"static/chunks/pages/Getting-Started-8e9a8ab5ed31839b.js"],"/Installation":[e,"static/chunks/pages/Installation-048a2c75d4cde1c5.js"],"/Log-Viewer":[e,"static/chunks/pages/Log-Viewer-458840c22be40d80.js"],"/Memory-Viewer":[e,"static/chunks/pages/Memory-Viewer-dd3d33cfe929fd44.js"],"/Network-Inspector":[e,"static/chunks/pages/Network-Inspector-b7d8a61d2d542ffd.js"],"/Route-Tracker":[e,"static/chunks/pages/Route-Tracker-8d1b310180aa3bf2.js"],"/Timeline":[e,"static/chunks/pages/Timeline-a6d10ad811492520.js"],"/Usage":[e,"static/chunks/pages/Usage-405dadea5015323f.js"],"/_error":["static/chunks/pages/_error-7a92967bea80186d.js"],"/_meta":["static/chunks/pages/_meta-b47e7a01bb6b7929.js"],sortedPages:["/","/Alerts","/Configuration","/Custom-Database-Provider","/Database-Viewer","/Errors","/FAQ","/FPS-Viewer","/Getting-Started","/Installation","/Log-Viewer","/Memory-Viewer","/Network-Inspector","/Route-Tracker","/Timeline","/Usage","/_app","/_error","/_meta"]}}("static/chunks/812-3fcedf6f3c3b1908.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file +self.__BUILD_MANIFEST=function(e){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":[e,"static/chunks/pages/index-09093d7a1b2e97fb.js"],"/Alerts":[e,"static/chunks/pages/Alerts-a070cfa208c3ff82.js"],"/Configuration":[e,"static/chunks/pages/Configuration-59d63292bf84e213.js"],"/Custom-Database-Provider":[e,"static/chunks/pages/Custom-Database-Provider-bbe4c3db5859578c.js"],"/Database-Viewer":[e,"static/chunks/pages/Database-Viewer-bae8bb7c99f3f2a2.js"],"/Errors":[e,"static/chunks/pages/Errors-3214b059d0e33517.js"],"/FAQ":[e,"static/chunks/pages/FAQ-09aca322a5a031c7.js"],"/FPS-Viewer":[e,"static/chunks/pages/FPS-Viewer-954be0ba8ec208c8.js"],"/Getting-Started":[e,"static/chunks/pages/Getting-Started-8e9a8ab5ed31839b.js"],"/Installation":[e,"static/chunks/pages/Installation-451e2c8dbda34e0e.js"],"/Log-Viewer":[e,"static/chunks/pages/Log-Viewer-458840c22be40d80.js"],"/Memory-Viewer":[e,"static/chunks/pages/Memory-Viewer-dd3d33cfe929fd44.js"],"/Network-Inspector":[e,"static/chunks/pages/Network-Inspector-b7d8a61d2d542ffd.js"],"/Route-Tracker":[e,"static/chunks/pages/Route-Tracker-8d1b310180aa3bf2.js"],"/Timeline":[e,"static/chunks/pages/Timeline-a6d10ad811492520.js"],"/Usage":[e,"static/chunks/pages/Usage-405dadea5015323f.js"],"/_error":["static/chunks/pages/_error-7a92967bea80186d.js"],"/_meta":["static/chunks/pages/_meta-b47e7a01bb6b7929.js"],sortedPages:["/","/Alerts","/Configuration","/Custom-Database-Provider","/Database-Viewer","/Errors","/FAQ","/FPS-Viewer","/Getting-Started","/Installation","/Log-Viewer","/Memory-Viewer","/Network-Inspector","/Route-Tracker","/Timeline","/Usage","/_app","/_error","/_meta"]}}("static/chunks/812-3fcedf6f3c3b1908.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/docs/_next/static/rhZ5TDhK5xNMS7pIlRbZf/_ssgManifest.js b/docs/_next/static/4hyj41opBQbKAj5dw70NM/_ssgManifest.js similarity index 100% rename from docs/_next/static/rhZ5TDhK5xNMS7pIlRbZf/_ssgManifest.js rename to docs/_next/static/4hyj41opBQbKAj5dw70NM/_ssgManifest.js diff --git a/docs/_next/static/chunks/nextra-data-en-US.json b/docs/_next/static/chunks/nextra-data-en-US.json index 7bc0857..5207503 100644 --- a/docs/_next/static/chunks/nextra-data-en-US.json +++ b/docs/_next/static/chunks/nextra-data-en-US.json @@ -1 +1 @@ -{"/Alerts":{"title":"Alerts / 告警系统","data":{"overview--概述#Overview / 概述":"Available since v1.3.0v1.3.0 起可用\nThe alert system lets you define rules that proactively surface problems across network requests, logs, memory, and FPS — without manually scanning the panels.告警系统允许你定义规则,主动暴露网络请求、日志、内存、FPS 方面的问题,无需手动逐个面板排查。","how-it-works--工作原理#How It Works / 工作原理":"Rules are evaluated by AlertService whenever a relevant event occurs / 每当相关事件发生时,AlertService 会评估规则\nMatched rules produce alerts, and the unread count is exposed via a ValueNotifier / 命中的规则会生成告警,未读数通过 ValueNotifier 暴露\nThe floating button shows an unread-count badge; opening the panel clears it / 悬浮球显示未读数量角标,打开面板即清零\nAn Alerts tab in the inspector panel lists all triggered alerts / 检查器面板的 Alerts 标签页列出所有已触发的告警","rule-types--规则类型#Rule Types / 规则类型":"Type\tTrigger / 触发条件\tExample / 示例\tNetwork\tResponse status code / 响应状态码\tAlert when status ≥ 400 / 状态码 ≥ 400 时告警\tLog\tLog level or message / 日志级别或内容\tAlert on error logs / 出现 error 日志时告警\tMemory\tDart heap / Native memory threshold / 内存阈值\tAlert when Dart heap > 100 MB / Dart 堆 > 100 MB 时告警\tFPS\tFrame rate / 帧率\tAlert when FPS < 50 / FPS < 50 时告警","ui-features--ui-功能#UI Features / UI 功能":"","floating-button-badge--悬浮球角标#Floating Button Badge / 悬浮球角标":"A red badge shows the current unread alert count (clamped 0–99) / 红色角标显示当前未读告警数(0–99)\nThe number is drawn inside the button so it is never clipped at screen edges / 数字直接绘制在按钮内部,吸附屏幕边缘时不会被裁切\nOpening the inspector panel clears the unread count / 打开检查器面板即清零未读数","alerts-tab--alerts-标签页#Alerts Tab / Alerts 标签页":"Lists triggered alerts with type, condition, and timestamp / 列出已触发告警的类型、条件与时间\nTap an alert to jump to the related panel (network / log / memory / FPS) / 点击告警可跳转到相关面板(网络 / 日志 / 内存 / FPS)","notes--备注#Notes / 备注":"Alerts are evaluated in-process and shown in the developer console only; they do not send data off-device / 告警仅在本机开发者控制台内评估与展示,不会将数据发送到设备外\nPersisted to disk (since v1.11.0): triggered alerts are flushed to the SQLite ring buffer and replay into the Alerts tab after an app restart, and are included in the session archive export / 已落盘持久化(v1.11.0 起):已触发的告警会写入 SQLite 环形缓冲,重启后回放至 Alerts 标签页,并包含在会话存档导出中\nThe alert system is tree-shaken out in release builds, like the rest of the inspector / 与检查器其余部分一样,告警系统在 release 构建中被 tree-shake 移除"}},"/Configuration":{"title":"Configuration / 配置说明","data":{"zeroinspectorkitinit-parameters--初始化参数#ZeroInspectorKit.init() Parameters / 初始化参数":"Parameter\tType\tDefault\tDescription\tenable\tbool\ttrue\tEnable inspector (auto false in release mode) / 启用检查器\tenableLogCapture\tbool\ttrue\tEnable log capture / 启用日志捕获\tenableNetworkCapture\tbool\ttrue\tEnable network interception / 启用网络拦截\tenableErrorCapture\tbool\ttrue\tEnable error aggregation (Errors tab) / 启用异常聚合(Errors 标签页)\tenablePersistence\tbool\ttrue\tPersist logs/network/errors to a SQLite ring buffer; logs & errors replay on launch / 将日志/网络/异常落盘到 SQLite 环形缓冲,启动时回放日志与异常\tenableFlutterLeakTracker\tbool\ttrue\tBridge Flutter's official MemoryAllocations as a second leak-detection source / 桥接 Flutter 官方 MemoryAllocations 作为泄漏检测第二来源\tenableDatabaseScan\tbool\ttrue\tEnable database scan / 启用数据库扫描\tenableRouteTracking\tbool\ttrue\tEnable route tracking / 启用路由追踪\tenableWidgetInspector\tbool\ttrue\tEnable Widget tree snapshot / 启用 Widget 树快照\tenableNetworkTimeline\tbool\ttrue\tPrefer the network timeline (waterfall) in request details / 网络详情页默认展示时间轴(瀑布图)\tcustomButton\tWidget?\tnull\tCustom floating button widget / 自定义悬浮按钮\tonLogCaptured\tvoid Function(LogEntry)?\tnull\tLog capture callback for third-party integration / 日志捕获回调\tmaxNetworkItems\tint?\t100\tNetwork request cache cap / 网络请求缓存上限\tmaxLogItems\tint?\t500\tLog entry cache cap / 日志条目缓存上限\tmaxRouteItems\tint?\t200\tRoute record cache cap / 路由记录缓存上限\tmaxBodyPreviewBytes\tint?\t32KB\tBody preview cap, longer bodies truncated / body 预览字节上限,超出截断\t\nenableWidgetInspector / enableNetworkTimeline are also exposed on runAppWithInspector(). (wrapApp() takes only enable.)enableWidgetInspector / enableNetworkTimeline 也可在 runAppWithInspector() 上设置(wrapApp() 仅接受 enable)。","usage-examples--使用示例#Usage Examples / 使用示例":"","disable-specific-features--禁用特定功能#Disable Specific Features / 禁用特定功能":"ZeroInspectorKit.init(\n enableLogCapture: true,\n enableNetworkCapture: false, // Disable network monitoring / 禁用网络监控\n enableDatabaseScan: true,\n enableRouteTracking: false, // Disable route tracking / 禁用路由追踪\n);","with-log-callback--带日志回调#With Log Callback / 带日志回调":"ZeroInspectorKit.init(\n onLogCaptured: (entry) {\n // Forward to your logging service / 转发到你的日志服务\n myLogger.log(entry.message);\n },\n);","conditionalinspector--条件检查器组件#ConditionalInspector / 条件检查器组件":"A convenience widget that automatically shows/hides the inspector based on build mode.根据构建模式自动显示/隐藏检查器的便利组件。\nConditionalInspector(\n child: YourAppWidget(),\n)\nParameter\tType\tDefault\tDescription\tchild\tWidget\trequired\tChild widget / 子组件\tenabled\tbool\ttrue\tEnable inspector / 启用检查器","floatinginspectorbutton--悬浮检查器按钮#FloatingInspectorButton / 悬浮检查器按钮":"Parameter\tType\tDefault\tDescription\tenabled\tbool\ttrue\tEnable button (auto false in release mode) / 启用按钮","inspectorloginterceptor--日志拦截器#InspectorLogInterceptor / 日志拦截器":"Method\tDescription\tstart()\tStart capturing logs / 开始捕获日志\tstop()\tStop capturing logs / 停止捕获日志\tlog(level, message, tag)\tAdd a log entry / 添加日志条目\tverbose(message, tag)\tAdd verbose log / 添加详细日志\tdebug(message, tag)\tAdd debug log / 添加调试日志\tinfo(message, tag)\tAdd info log / 添加信息日志\twarning(message, tag)\tAdd warning log / 添加警告日志\terror(message, tag)\tAdd error log / 添加错误日志\t\nProperty\tType\tDescription\tonLogCaptured\tvoid Function(LogEntry)?\tCallback when a log is captured / 日志捕获回调","inspectorrouteobserver--路由观察者#InspectorRouteObserver / 路由观察者":"Navigator observer for tracking route changes. Auto-injected when using runAppWithInspector() or wrapApp().用于追踪路由变化的 Navigator 观察者。使用 runAppWithInspector() 或 wrapApp() 时自动注入。\nMaterialApp(\n navigatorObservers: [InspectorRouteObserver()],\n home: MyHomePage(),\n)","databaseregistry--数据库注册表#DatabaseRegistry / 数据库注册表":"Register custom database providers:注册自定义数据库提供者:\nDatabaseRegistry.instance.registerProvider(SqliteDatabaseProvider());\nSee Custom Database Provider for more details.详见 自定义数据库提供者。","inspectorlog--简化日志-api#InspectorLog / 简化日志 API":"Available since v1.1.2 / v1.1.2 起可用\nA static wrapper around InspectorLogInterceptor.instance for shorter log calls.InspectorLogInterceptor.instance 的静态包装,用于更简短的日志调用。\nInspectorLog.v('Verbose log');\nInspectorLog.d('Debug log');\nInspectorLog.i('Info log', tag: 'Auth');\nInspectorLog.w('Warning log');\nInspectorLog.e('Error log');\nMethod\tDescription\tstart()\tStart capturing logs / 开始捕获日志\tstop()\tStop capturing logs / 停止捕获日志\tlog(level, message, {tag})\tAdd a log entry / 添加日志条目\tv(message, {tag})\tAdd verbose log / 添加详细日志\td(message, {tag})\tAdd debug log / 添加调试日志\ti(message, {tag})\tAdd info log / 添加信息日志\tw(message, {tag})\tAdd warning log / 添加警告日志\te(message, {tag})\tAdd error log / 添加错误日志\t\nProperty\tType\tDescription\tisRunning\tbool\tWhether log capture is currently active / 日志捕获是否正在运行","memoryinspectorservice--内存监控服务#MemoryInspectorService / 内存监控服务":"Available since v1.1.0 / v1.1.0 起可用\nSingleton service for memory monitoring and leak detection, extends ChangeNotifier.内存监控与泄漏检测单例服务,继承 ChangeNotifier。","full-api--完整接口#Full API / 完整接口":"// Leak tracking (full form) / 泄漏追踪(完整写法)\nMemoryInspectorService.instance.trackObject(\n myController,\n tag: 'HomeController_textController',\n expectedReleaseAfter: const Duration(seconds: 30),\n);\nMemoryInspectorService.instance.untrackObject(myController);\nMemoryInspectorService.instance.clearLeakRecords();","simplified-api--简化接口#Simplified API / 简化接口":"Available since v1.1.2 / v1.1.2 起可用\n// Extension method on Object / Object 上的扩展方法\nmyBloc.trackMemoryLeak(tag: 'HomePage_myBloc');\n// Top-level function / 顶层函数\ntrackMemoryLeak(myBloc, tag: 'HomePage_myBloc');\n// Cancel tracking / 取消追踪\nmyBloc.untrackMemoryLeak();\nSee Memory Viewer for full feature details.完整功能详情见 Memory Viewer。","flutter-memoryallocations-bridge--官方泄漏追踪桥接#Flutter MemoryAllocations Bridge / 官方泄漏追踪桥接":"Available since v1.9.0 / v1.9.0 起可用\nThe leak detector's own WeakReference state machine has a blind spot: an object whose dispose() ran but which has not been GC'd yet still resolves through the weak reference and is flagged as a suspected leak (false positive). LeakTrackerBridge subscribes to Flutter's official FlutterMemoryAllocations (the data source behind leak_tracker) as a second source: once the official stream reports disposed, the object is treated as released (awaiting GC) even if the weak reference still resolves — cutting false positives.自研泄漏检测的 WeakReference 状态机有一个盲点:对象已调用 dispose() 但尚未被 GC 时,弱引用仍存活,会被判定为\"疑似泄漏\"(误报)。LeakTrackerBridge 订阅 Flutter 官方的 FlutterMemoryAllocations(leak_tracker 背后的数据源)作为第二来源:只要官方上报了 disposed,即便弱引用仍存活也判定为已释放(等待 GC),从而显著降低误报。\nEnabled by default via ZeroInspectorKit.init()'s enableFlutterLeakTracker / 通过 init() 的 enableFlutterLeakTracker 默认启用\nOfficial events only cover framework types that report to FlutterMemoryAllocations (Image / Picture / Layer …) — it supplements, not replaces, the custom detector / 官方事件只覆盖会上报给 FlutterMemoryAllocations 的框架类型(如 Image / Picture / Layer),因此是补充而非替代自研方案","errorservice--异常聚合服务#ErrorService / 异常聚合服务":"Available since v1.9.0 / v1.9.0 起可用\nSingleton service for aggregated error capture, extends ChangeNotifier. Hooks FlutterError.onError (keeping the default red error behavior) and dedups each exception by type + stack signature. See Errors for full feature details.异常聚合单例服务,继承 ChangeNotifier。接管 FlutterError.onError(保留默认红色报错行为),按类型 + 堆栈签名去重聚合。完整功能见 Errors。\n// Report an exception manually (gRPC / custom protocols) / 手动上报异常\nErrorService.instance.report(error, stackTrace, 'myModule');\n// Read aggregated records (newest first) / 读取聚合记录(最新在前)\nfinal ErrorRecord r = ErrorService.instance.errors.first;\n// Toggle capture / 切换抓取开关\nErrorService.instance.isEnabled = false;\n// Clear all records / 清空全部记录\nErrorService.instance.clear();\nMember\tDescription\terrors\tList — aggregated records, newest first / 聚合记录,最新在前\terrorCount\tint — aggregated record count / 聚合记录条数\tisEnabled\tbool — capture toggle (programmatic) / 抓取开关(代码控制)\treport(exception, stack, [context])\tManually report an exception / 手动上报异常\trestore(records)\tRestore persisted records (replay on launch) / 恢复持久化记录(启动回放)\tclear()\tClear all aggregated records / 清空所有聚合记录\tinstall() / uninstall()\tHook / restore FlutterError.onError / 接管 / 还原 FlutterError.onError","persistenceservice--持久化服务#PersistenceService / 持久化服务":"Available since v1.9.0 / v1.9.0 起可用\nSingleton service that async-flushes logs, network requests, and aggregated errors to a local SQLite ring buffer (zero_inspector_kit.db) so data survives app restarts. On launch, logs and aggregated errors replay into their tabs; network requests stay archived on disk for later export. Everything is guarded and degrades gracefully: if the DB is unavailable (e.g. desktop without sqflite FFI) isEnabled is false and writes become no-ops, never affecting the host app.单例服务,将日志、网络请求与聚合异常异步落盘到本地 SQLite 环形缓冲(zero_inspector_kit.db),使数据跨重启不丢。启动时日志与聚合异常回放入各自标签页;网络请求保留在磁盘存档,供之后导出。所有操作都有保护并优雅降级:数据库不可用(如桌面端未配置 sqflite FFI)时 isEnabled 为 false,写入变为空操作,绝不影响宿主应用。","tuning--调参#Tuning / 调参":"await PersistenceService.instance.init(\n maxRowsPerTable: 5000, // rows kept per table / 每表保留行数\n retention: const Duration(days: 7), // retention window / 保留时长\n flushInterval: const Duration(seconds: 2), // disk flush interval / 刷盘间隔\n);\nEnabled by default via ZeroInspectorKit.init()'s enablePersistence — the ring buffer flushes automatically, so no manual init() call is needed in normal use.通过 init() 的 enablePersistence 默认启用——环形缓冲会自动刷盘,常规使用无需手动调用 init()。\nMember\tDescription\tisEnabled\tbool — whether the DB is available / 数据库是否可用\tmaxRowsPerTable\tint — row cap per table (ring-buffer trim line) / 每表行数上限\tenqueueLog(e) / enqueueNetwork(r) / enqueueError(e)\tEnqueue an item for async flush / 入队待异步落盘\tflush()\tFlush the buffer to disk and trim / 刷盘并按环形缓冲裁剪\tloadLogs() / loadErrors() / loadNetworkJson()\tLoad persisted data, newest first / 读取已持久化数据(最新在前)\tbuildSessionArchiveJson()\tBuild the full-session archive JSON (logs + errors + network) / 构建完整会话存档 JSON\texportSessionArchiveAndShare()\tExport & share the full-session archive via the system share sheet / 导出并分享完整会话存档\tclearAll()\tClear persisted data on disk / 清空磁盘上的持久化数据\tdispose()\tFlush then close / 先刷盘再关闭","persisted-data-manager--持久化数据管理#Persisted Data Manager / 持久化数据管理":"Tap the storage icon in the panel header to open the Persisted data sheet: it shows the current row counts per category (logs / network / errors), the per-table cap, and whether the data will be replayed on the next launch. Actions:点击面板头部的存储图标打开 Persisted data 管理弹层:展示各类别当前行数(logs / network / errors)、每表上限,以及下次启动是否会回放。支持的操作:\nExport & share session archive — share a JSON snapshot of the whole session / 导出并分享会话存档——分享本次会话完整 JSON 快照\nClear disk — wipe persisted rows so the next launch replays nothing / 清空磁盘——清空持久化数据,下次启动干净\nClear disk & lists — wipe disk and the in-memory lists together / 同时清空磁盘与列表——连同内存列表一并清空","fpsservice--fps-监控服务#FpsService / FPS 监控服务":"Available since v1.2.0 / v1.2.0 起可用\nSingleton service for FPS monitoring, extends ChangeNotifier.FPS 监控单例服务,继承 ChangeNotifier。\nFpsService.instance.start();\nFpsService.instance.stop();\nFpsService.instance.clear();\nfinal fps = FpsService.instance.currentFps;\nfinal jankRate = FpsService.instance.jankRate;\nMethod\tDescription\tstart()\tStart FPS monitoring / 开始 FPS 监控\tstop()\tStop FPS monitoring / 停止 FPS 监控\tclear()\tClear all historical data and counters / 清空所有历史数据和计数器\t\nProperty\tType\tDescription\tisRunning\tbool\tWhether monitoring is currently active / 是否正在监控\tcurrentFps\tdouble\tCurrent FPS (updated every 500ms) / 当前 FPS(每 500ms 更新)\tjankRate\tdouble\tJank rate as percentage / 卡顿率(百分比)\ttotalFrameCount\tint\tTotal frames captured / 总帧数\ttotalJankyCount\tint\tTotal janky frames (>16ms) / 总卡顿帧数(>16ms)\tlastFrameJanky\tbool\tWhether the most recent frame was janky / 最近一帧是否卡顿\tfpsHistory\tList\tRecent 60 FPS values (unmodifiable) / 最近 60 个 FPS 值(不可变)\tframeRecords\tList\tRecent frame records (unmodifiable, up to 3600) / 最近帧记录(不可变,最多 3600 条)\t\nSee FPS Viewer for full feature details.完整功能详情见 FPS Viewer。"}},"/Custom-Database-Provider":{"title":"Custom Database Provider / 自定义数据库提供者","data":{"overview--概述#Overview / 概述":"Zero Inspector Kit supports extending database inspection beyond SQLite through the DatabaseProvider interface.Zero Inspector Kit 通过 DatabaseProvider 接口支持扩展数据库检查功能到 SQLite 以外的数据库。","databaseprovider-interface--接口定义#DatabaseProvider Interface / 接口定义":"abstract class DatabaseProvider {\n /// Provider name / 提供者名称\n String get name;\n /// Get list of databases / 获取数据库列表\n Future> getDatabases();\n /// Query table data / 查询表数据\n Future queryTable(String dbPath, String tableName, {int limit = 50});\n}","data-models--数据模型#Data Models / 数据模型":"","databaseinfo#DatabaseInfo":"Field\tType\tDescription\tname\tString\tDatabase name / 数据库名称\tpath\tString\tDatabase file path / 数据库文件路径\ttables\tList\tList of tables / 表列表","tableinfo#TableInfo":"Field\tType\tDescription\tname\tString\tTable name / 表名\trowCount\tint\tRow count / 行数","queryresult#QueryResult":"Field\tType\tDescription\tcolumns\tList\tColumn names / 列名\trows\tList>\tRow data / 行数据","example-custom-provider--示例自定义提供者#Example: Custom Provider / 示例:自定义提供者":"class MyCustomDatabaseProvider implements DatabaseProvider {\n @override\n String get name => 'CustomDB';\n @override\n Future> getDatabases() async {\n // Return your custom databases / 返回你的自定义数据库列表\n return [\n DatabaseInfo(\n name: 'my_database',\n path: '/path/to/my_database',\n tables: [\n TableInfo(name: 'users', rowCount: 100),\n TableInfo(name: 'orders', rowCount: 500),\n ],\n ),\n ];\n }\n @override\n Future queryTable(\n String dbPath,\n String tableName, {\n int limit = 50,\n }) async {\n // Execute query and return results / 执行查询并返回结果\n return QueryResult(\n columns: ['id', 'name', 'value'],\n rows: [\n {'id': 1, 'name': 'item1', 'value': '100'},\n {'id': 2, 'name': 'item2', 'value': '200'},\n ],\n );\n }\n}","register-provider--注册提供者#Register Provider / 注册提供者":"// Register your custom provider / 注册自定义提供者\nDatabaseRegistry.instance.registerProvider(MyCustomDatabaseProvider());","built-in-provider--内置提供者#Built-in Provider / 内置提供者":"The plugin includes SqliteDatabaseProvider which is auto-registered when enableDatabaseScan is true (default).插件内置 SqliteDatabaseProvider,当 enableDatabaseScan 为 true(默认)时自动注册。You can also register it manually:也可以手动注册:\nDatabaseRegistry.instance.registerProvider(SqliteDatabaseProvider());"}},"/Database-Viewer":{"title":"Database Viewer / 数据库查看器","data":{"overview--概述#Overview / 概述":"The Database Viewer inspects SQLite databases in your app with a two-level navigation system.数据库查看器通过双层导航系统检查应用中的 SQLite 数据库。","auto-scan--自动扫描#Auto-Scan / 自动扫描":"The inspector automatically scans the following directories for .db and .sqlite files:检查器自动扫描以下目录中的 .db 和 .sqlite 文件:\ngetApplicationDocumentsDirectory() / 应用文档目录\ngetDatabasesPath() / 数据库目录","two-level-navigation--双层导航#Two-Level Navigation / 双层导航":"","level-1-database-list-global--第一层数据库列表全局#Level 1: Database List (Global) / 第一层:数据库列表(全局)":"Shows all discovered databases / 显示所有发现的数据库\nEach database shows name and table count / 每个数据库显示名称和表数量\nGlobal search: Search database names and table names / 全局搜索:搜索数据库名和表名","level-2-database-detail--第二层数据库详情#Level 2: Database Detail / 第二层:数据库详情":"Click a database to enter its detail view / 点击数据库进入详情视图\nLeft panel: table list with row counts / 左侧面板:表列表(含行数)\nRight panel: table data in DataTable format / 右侧面板:DataTable 格式的表数据\nBack button to return to database list / 返回按钮返回数据库列表\nIn-database search: Search table names AND all column data / 数据库内搜索:搜索表名和所有列数据","search--搜索#Search / 搜索":"Level\tSearch Scope\tGlobal (database list)\tDatabase names, table names / 数据库名、表名\tIn-database\tTable names, all column values in all tables / 表名、所有表的所有列值","search-highlights--搜索高亮#Search Highlights / 搜索高亮":"When searching within a database, matching cell values are highlighted in accent color.在数据库内搜索时,匹配的单元格值以强调色高亮显示。","ui-features--ui-功能#UI Features / UI 功能":"Color-coded table icons / 带颜色的表图标\nRow count badges for each table / 每个表的行数徽章\nSelected table highlighted / 选中表高亮\nHorizontal and vertical scrollable data table / 水平和垂直可滚动的数据表\nRow count display (filtered / total) when searching / 搜索时显示行数(过滤/总数)","custom-database-provider--自定义数据库提供者#Custom Database Provider / 自定义数据库提供者":"For non-SQLite databases, see Custom Database Provider.对于非 SQLite 数据库,请参阅 自定义数据库提供者。"}},"/Errors":{"title":"Errors / 异常聚合查看器","data":{"overview--概述#Overview / 概述":"Available since v1.9.0v1.9.0 起可用\nThe Errors tab surfaces \"the same crash happening repeatedly\". When the inspector is running, ErrorService hooks both FlutterError.onError and PlatformDispatcher.onError (keeping the default red-screen / console behavior for both) and aggregates every exception by type + stack signature. Repeated instances of the same crash merge into one record that shows how many times it occurred and when it was first/last seen — instead of flooding the log with hundreds of identical stack traces.Errors 标签页用来快速发现\"同一处崩溃反复出现\"的问题。检查器运行时,ErrorService 会接管 FlutterError.onError(保留默认的红色报错与控制台行为),把每次异常按类型 + 堆栈签名去重聚合:同一处崩溃的多次发生会合并为一条记录,展示累计次数与首末次时间——而不是用成百上千条相同的堆栈刷屏日志。","what-gets-captured--捕获来源#What Gets Captured / 捕获来源":"Source / 来源\tHow / 方式\tFlutter framework errors / Flutter 框架异常\tHooks FlutterError.onError (default handler kept) / 接管 FlutterError.onError(保留默认处理)\tFramework-boundary & platform-channel errors / 框架边界外与平台通道异常\tPlatformDispatcher.onError (with save/restore) / PlatformDispatcher.onError(接管 + 还原)\tUncaught async errors / 未捕获异步异常\trunZonedGuarded inside runAppWithInspector() / runAppWithInspector() 内部的 runZonedGuarded\tManual reports / 手动上报\tErrorService.instance.report(exception, stackTrace) — for gRPC / custom protocols / your own error paths / 用于 gRPC / 自定义协议或你自己的错误通道\t\nCaptured records are also persisted to disk (see Session Persistence below), so aggregated errors from previous sessions are replayed on the next launch.捕获到的记录也会落盘持久化(见下文会话持久化),下次启动时会回放上次会话的聚合异常。","deduplication--去重规则#Deduplication / 去重规则":"Records are keyed by exception type plus a stack signature (first frames with line/address noise stripped) / 按异常类型 + 堆栈签名(取前若干帧并去掉行号/地址噪声)去重\nA new occurrence of an existing signature bumps its count and updates lastSeen instead of adding a new row / 同签名的再次发生只累加 count 并更新 lastSeen,不新增行\nRing buffer capped at 200 aggregated records (oldest dropped) / 环形缓冲上限 200 条聚合记录(超出丢弃最旧)","ui-features--ui-功能#UI Features / UI 功能":"","errors-tab--errors-标签页#Errors Tab / Errors 标签页":"Lists aggregated errors newest-first, showing the exception type, message, first seen / last seen time, and a ×N badge when the same crash recurred / 按最新在前列出聚合异常,展示异常类型、消息、首次/末次出现时间,同崩溃复发时显示 ×N 徽章\nTap a row to expand the full stack sample (truncated at 8000 chars); tap again to collapse / 点击行展开完整堆栈样本(8000 字符截断);再点收起\nCopy stack per row / 行内复制堆栈\nSearch filters by exception type or message / 搜索按异常类型或消息过滤\nClear empties the aggregated list / 清除清空聚合列表","tab-badge--标签页红点#Tab Badge / 标签页红点":"The Errors tab icon shows a red count badge while there are aggregated errors (capped at 99+), so recurring crashes are visible at a glance / Errors 标签页图标在有聚合异常时显示红色计数(99+ 封顶),一眼可见反复崩溃\nOpening the Errors tab is not required to see the badge — it reflects ErrorService.instance.errorCount whenever the panel is open / 只要面板打开,标签红点即反映 ErrorService.instance.errorCount,无需先进入 Errors 页\nNote: the floating ball itself stays clean — its red count (if any) is the Alerts unread badge (AlertService), not error aggregation.注意:悬浮球本身保持纯粹——球上的红色数字(如有)来自告警未读数(AlertService),与异常聚合无关。","api--接口#API / 接口":"The full service is re-exported from the package root — no need to import lib/src/.完整服务已从包根导出,无需 import lib/src/。\nimport 'package:zero_inspector_kit/zero_inspector_kit.dart';\n// Report an exception manually (gRPC/custom protocol/your own error paths) / 手动上报异常\nErrorService.instance.report(error, stackTrace, 'myModule');\n// Read the aggregated view (newest first) / 读取聚合视图(最新在前)\nfinal ErrorRecord latest = ErrorService.instance.errors.first;\nprint('${latest.type} x${latest.count} — first ${latest.firstSeen} / last ${latest.lastSeen}');\n// Clear all records / 清空所有记录\nErrorService.instance.clear();\nMember\tDescription\terrors\tList — aggregated records, newest first / 聚合记录,最新在前\terrorCount\tint — number of aggregated records / 聚合记录条数\tisEnabled\tbool — capture toggle (programmatic) / 抓取开关(代码控制)\treport(exception, stack, [context])\tManually report an exception / 手动上报异常\trestore(records)\tRestore persisted records (replay on launch; existing dedup ids are skipped) / 恢复持久化记录(启动回放;已存在的去重 id 跳过)\tclear()\tClear all aggregated records / 清空全部记录\tinstall() / uninstall()\tHook / restore FlutterError.onError and PlatformDispatcher.onError / 接管 / 还原 FlutterError.onError 与 PlatformDispatcher.onError","errorrecord--异常记录#ErrorRecord / 异常记录":"Field\tDescription\ttype\tException type name (e.g. _TypeError) / 异常类型名\tmessage\tException message / 异常消息\tcount\tTotal occurrences / 累计出现次数\tfirstSeen / lastSeen\tFirst / last occurrence time / 首次 / 末次出现时间\tsampleStack\tOne full stack sample (may be truncated) / 一条完整堆栈样本(可能截断)","session-persistence--会话持久化#Session Persistence / 会话持久化":"Errors — together with logs, network requests and alerts — are asynchronously flushed to a local SQLite ring buffer (zero_inspector_kit.db). On the next launch, logs, aggregated errors and alerts replay into their tabs, so a crash you saw yesterday is still inspectable today even though the panel was never opened; network requests stay archived on disk for later export. Use the storage icon in the panel header to open the Persisted data manager: see the current row counts, export the full session archive as JSON, or clear the disk. See Configuration (PersistenceService section) for details and the tuning parameters.异常与日志、网络请求、告警一起被异步写入本地 SQLite 环形缓冲(zero_inspector_kit.db)。下次启动时,日志、聚合异常与告警会回放入各自标签页——即使昨天从没打开过面板,今天依然能复盘当时的崩溃现场;网络请求保留在磁盘存档,供之后导出。点击面板头部的存储图标可打开 Persisted data 管理弹层:查看当前行数、导出完整会话存档 JSON,或清空磁盘。详见 Configuration(PersistenceService 一节)的参数说明。","enable--disable--开关#Enable / Disable / 开关":"enableErrorCapture (default true) in ZeroInspectorKit.init() controls error aggregation / init() 的 enableErrorCapture(默认 true)控制异常聚合\nenablePersistence (default true) controls the disk ring buffer / enablePersistence(默认 true)控制磁盘环形缓冲\nSet both to false to keep everything in memory only / 两者都设为 false 时数据仅保留在内存\nZeroInspectorKit.init(\n enableErrorCapture: true,\n enablePersistence: true, // false → memory-only / 关闭后仅内存\n);","related--相关#Related / 相关":"Log Viewer — raw log stream including error lines / 原始日志流(含错误行)\nConfiguration — init parameters and full service APIs / 初始化参数与完整服务接口\nUsage — general usage guide / 使用指南"}},"/FAQ":{"title":"FAQ / 常见问题","data":{"general--通用#General / 通用":"","q-does-the-inspector-affect-production-builds--检查器会影响生产构建吗#Q: Does the inspector affect production builds? / 检查器会影响生产构建吗?":"A: No. The inspector is automatically disabled in release mode via kReleaseMode. Flutter's tree-shaking removes all inspector-related code from production builds. You don't need to remove any code.不会。 检查器在 release 模式下通过 kReleaseMode 自动禁用。Flutter 的 tree-shaking 会移除所有检查器相关代码,无需手动移除。","q-what-platforms-are-supported--支持哪些平台#Q: What platforms are supported? / 支持哪些平台?":"A: Android and iOS.支持 Android 和 iOS。","q-what-flutterdart-versions-are-required--需要什么-flutterdart-版本#Q: What Flutter/Dart versions are required? / 需要什么 Flutter/Dart 版本?":"A: Flutter >= 3.3.0, Dart SDK >= 3.11.0 < 4.0.0.Flutter >= 3.3.0,Dart SDK >= 3.11.0 < 4.0.0。","network--网络#Network / 网络":"","q-do-i-need-to-manually-add-interceptors-for-dio--需要为-dio-手动添加拦截器吗#Q: Do I need to manually add interceptors for Dio? / 需要为 Dio 手动添加拦截器吗?":"A: No. Dio uses IOHttpClientAdapter internally, which uses dart:io's HttpClient. The inspector captures all requests via HttpOverrides automatically, making it truly zero-invasion for both http package and Dio.不需要。 Dio 内部使用 IOHttpClientAdapter,底层使用 dart:io 的 HttpClient。检查器通过 HttpOverrides 自动捕获所有请求,对 http 包和 Dio 都是真正的零侵入。","q-why-do-i-see-duplicate-dio-requests--为什么看到重复的-dio-请求#Q: Why do I see duplicate Dio requests? / 为什么看到重复的 Dio 请求?":"A: If you use both InspectorDioInterceptor and the auto-capture (HttpOverrides), Dio requests will be recorded twice. Simply remove the manual InspectorDioInterceptor — auto-capture handles everything.如果同时使用了 InspectorDioInterceptor 和自动捕获(HttpOverrides),Dio 请求会被记录两次。移除手动 InspectorDioInterceptor 即可,自动捕获会处理一切。","q-can-i-modify-requests-during-testing--测试时可以修改请求吗#Q: Can I modify requests during testing? / 测试时可以修改请求吗?":"A: Yes (since v1.0.7). The inspector supports intercepting and modifying requests via rules. Open a request detail and tap the Interceptor icon to configure a rule. You can modify the request body and request headers only — response fields (status code, response body) are read-only (since v1.0.8). GET requests cannot be modified (no request body). The master toggle is on the Network list page; rules only apply when modification mode is enabled.可以(v1.0.7 起)。检查器支持通过规则拦截并修改请求。打开请求详情,点击拦截器图标配置规则。仅可修改请求体和请求头——响应字段(状态码、响应体)只读(v1.0.8 起)。GET 请求不可修改(无请求体)。总开关在 Network 列表页,规则仅在启用修改模式时生效。See Network Inspector > Request Interceptor for details.详见 Network Inspector > 请求拦截修改。","logging--日志#Logging / 日志":"","q-can-i-use-my-existing-logging-library--可以使用现有的日志库吗#Q: Can I use my existing logging library? / 可以使用现有的日志库吗?":"A: Yes! The inspector automatically captures logs from any library that uses print() or debugPrint(). No configuration needed. Third-party logs are categorized as Info level.可以! 检查器会自动捕获任何使用 print() 或 debugPrint() 的日志库的日志,无需配置。第三方日志统一归类为 Info 级别。","q-how-to-sync-inspector-logs-to-my-logger--如何将检查器日志同步到我的日志库#Q: How to sync inspector logs to my logger? / 如何将检查器日志同步到我的日志库?":"A: Use the onLogCaptured callback:使用 onLogCaptured 回调:\nInspectorLogInterceptor.instance.onLogCaptured = (entry) {\n yourLogger.log(entry.message);\n};\nWarning: Do NOT call print() or logging methods inside this callback, as it will cause infinite recursion.\n警告:不要在此回调中调用 print() 或日志方法,否则会导致无限递归。","database--数据库#Database / 数据库":"","q-why-dont-i-see-any-databases--为什么看不到数据库#Q: Why don't I see any databases? / 为什么看不到数据库?":"A: The inspector scans getApplicationDocumentsDirectory() and getDatabasesPath() for .db and .sqlite files. If your database is stored elsewhere, you can implement a custom DatabaseProvider.检查器扫描 getApplicationDocumentsDirectory() 和 getDatabasesPath() 目录中的 .db 和 .sqlite 文件。如果你的数据库存储在其他位置,可以实现自定义 DatabaseProvider。","memory--内存#Memory / 内存":"","q-why-does-dart-heap-show-na-when-debugging-via-pc--通过-pc-调试时为什么-dart-heap-显示-na#Q: Why does Dart Heap show \"N/A\" when debugging via PC? / 通过 PC 调试时为什么 Dart Heap 显示 \"N/A\"?":"A: This is an expected behavior. When using flutter run to debug via PC, the flutter tool sets up port forwarding between PC and device via adb reverse, allowing PC-side DevTools to access the device's VM Service. However, Service.getInfo() returns a serverUri from the PC's perspective; when the app process internally accesses 127.0.0.1:PC_port, the device doesn't have that port listening locally, resulting in Connection refused and VM Service showing OFF.这是预期行为。 使用 flutter run 连接 PC 调试时,flutter tool 会通过 adb reverse 在 PC 和设备之间做端口转发,让 PC 上的 DevTools 能访问设备的 VM Service。但应用进程内部 Service.getInfo() 返回的 serverUri 是 PC 视角的端口,应用进程访问 127.0.0.1:PC端口 时设备本地并没有监听该端口,导致 Connection refused,VM Service 显示 OFF。Workarounds / 解决方案:\nOpen the debug app directly without PC connection — VM Service works normally / 直接打开 debug 应用(不连 PC),VM Service 正常工作\nUse Native memory data (Android PSS / iOS physicalFootprint) as fallback — always available / 使用 Native 内存数据(Android PSS / iOS physicalFootprint)作为降级,始终可用\nProcess RSS is always available regardless of VM Service / 进程 RSS 无论 VM Service 状态都可用\nSee Memory Viewer > VM Service Availability for details.详见 Memory Viewer > VM Service 可用性。","q-does-memory-monitoring-affect-performance--内存监控会影响性能吗#Q: Does memory monitoring affect performance? / 内存监控会影响性能吗?":"A: Memory monitoring is off by default (since v1.1.0). When disabled, all timers are stopped and VM Service connection is cleared, leaving zero overhead. When enabled, refresh intervals are optimized:内存监控默认关闭(v1.1.0 起)。关闭时所有定时器停止、VM Service 连接清空,零开销。开启时刷新间隔已优化:\nProcess RSS / Dart Heap: 500ms\nNative Memory: 3000ms\nStorage Stats: 3000ms\nLeak Detection: 2000ms\nYou can toggle the switch at the top of the Memory panel anytime.可随时在 Memory 面板顶部切换开关。","q-does-leak-detection-require-code-modification--泄漏检测需要侵入代码吗#Q: Does leak detection require code modification? / 泄漏检测需要侵入代码吗?":"A: The current implementation uses WeakReference + Finalizer, which requires calling trackObject() to register objects for tracking. This is a mild invasion (one line of code per tracked object).当前实现使用 WeakReference + Finalizer,需要调用 trackObject() 注册要追踪的对象。这是轻度侵入(每个追踪对象一行代码)。Trade-offs / 取舍:\nPros: 100% reliable, doesn't depend on VM Service, works in release mode / 100% 可靠,不依赖 VM Service,release 模式也可用\nCons: Requires user to know which objects to track / 需要用户知道要追踪哪些对象\nA zero-invasion Heap Snapshot comparison feature (based on VM Service) is technically possible but would strongly depend on VM Service availability (unavailable when debugging via PC), with significant performance overhead. Not currently implemented.零侵入的 Heap Snapshot 对比功能(基于 VM Service)技术上可行,但会强依赖 VM Service 可用性(PC 调试时不可用),且有显著性能开销。目前未实现。See Memory Viewer > Memory Leak Detection for API details.详见 Memory Viewer > 内存泄漏检测 了解 API 详情。","fps--帧率#FPS / 帧率":"","q-why-does-fps-show-a-very-low-value-eg-9-10-fps--为什么-fps-显示很低如-9-10#Q: Why does FPS show a very low value (e.g. 9-10 FPS)? / 为什么 FPS 显示很低(如 9-10)?":"A: This was a bug fixed in v1.2.0. The root cause was that _recentFrameTimestamps.add(now) was placed outside the for-loop in _onFrameTimings; since Flutter engine's addTimingsCallback is batched (may return multiple frames per call), only one timestamp was recorded per batch, undercounting FPS by 6-10x. Upgrade to ^1.2.0 to fix this.这是 v1.2.0 已修复的 bug。根因是 _onFrameTimings 中 _recentFrameTimestamps.add(now) 在 for 循环外;Flutter 引擎的 addTimingsCallback 是批量回调(一次可能返回多帧),但每批只记录 1 个时间戳,导致 FPS 计算偏低 6-10 倍。升级到 ^1.2.0 即可修复。See FPS Viewer for details.详见 FPS Viewer。","q-does-fps-monitoring-affect-performance--fps-监控会影响性能吗#Q: Does FPS monitoring affect performance? / FPS 监控会影响性能吗?":"A: FPS monitoring is off by default (since v1.2.0). When disabled, no frame timings callbacks and no timers — zero overhead. When enabled, it only processes lightweight frame timing data with bounded history (60 trend points, up to 3600 frame records). You can toggle the switch at the top of the FPS panel anytime.FPS 监控默认关闭(v1.2.0 起)。关闭时无帧回调、无定时器——零开销。开启时仅处理轻量帧时序数据,历史有界(趋势 60 个点,帧记录最多 3600 条)。可随时在 FPS 面板顶部切换开关。","ui--界面#UI / 界面":"","q-the-inspector-panel-gets-pushed-up-when-keyboard-appears--键盘弹出时检查器面板被顶起来了#Q: The inspector panel gets pushed up when keyboard appears. / 键盘弹出时检查器面板被顶起来了。":"A: This was fixed in v1.0.6. The floating button and panel are rendered via Overlay, which is independent of the page layout and not affected by keyboard.此问题已在 v1.0.6 修复。悬浮按钮和面板通过 Overlay 渲染,独立于页面布局,不受键盘影响。","q-how-to-use-search--如何使用搜索#Q: How to use search? / 如何使用搜索?":"A: Each viewer has its own search bar at the top. Database viewer has two-level search: global search (database list) and in-database search (table names + all column data).每个查看器顶部都有搜索栏。数据库查看器有双层搜索:全局搜索(数据库列表)和数据库内搜索(表名 + 所有列数据)。","q-the-floating-button-disappeared--cant-be-opened-after-enabling-fps--开启-fps-后悬浮按钮消失无法打开#Q: The floating button disappeared / can't be opened after enabling FPS. / 开启 FPS 后悬浮按钮消失/无法打开。":"A: This was a bug fixed in v1.2.0. The root cause was that FpsService.notifyListeners() triggered Overlay rebuild; combined with the original Overlay lookup failure (using Overlay.of(context, rootOverlay: true) which returned null), the button State was destroyed and could not recover. Upgrade to ^1.2.0 which uses navigatorState.overlay instead.这是 v1.2.0 已修复的 bug。根因是 FpsService.notifyListeners() 触发 Overlay 重建,叠加原 Overlay 查找失败(使用 Overlay.of(context, rootOverlay: true) 返回 null),导致按钮 State 被销毁且无法恢复。升级到 ^1.2.0,改用 navigatorState.overlay 即可。","q-how-does-the-floating-button-edge-docking-work--悬浮按钮的边缘吸附怎么用#Q: How does the floating button edge docking work? / 悬浮按钮的边缘吸附怎么用?":"A: Since v1.2.0, when you drag the button near a screen edge and release, it auto-docks and tucks into the edge, leaving only a 24px peek visible. The icon becomes a directional chevron hinting you can tap to pull it out:\nTap the peek → smoothly pulls out to fully visible (panel NOT opened, avoids accidental open) / 平滑拉出到完全可见(不打开面板,避免误触)\nTap when fully visible → opens the inspector panel / 打开检查器面板\nThis design avoids conflicts with system back gestures (Android/iOS edge swipe to go back) when pulling out from the docked state.v1.2.0 起,拖动按钮靠近屏幕边缘松手即自动吸附并\"收入\"边缘,仅露 24px。图标变为方向箭头,提示可点击拉出:\n点击露出部分 → 平滑拉出到完全可见(不打开面板,避免误触)\n完全可见时点击 → 打开检查器面板\n此设计避免了从吸附态拖出时与系统返回手势(Android/iOS 边缘右滑退出)的冲突。See Usage > Edge Docking for details.详见 Usage > 边缘吸附。","license--许可证#License / 许可证":"","q-can-i-use-this-in-a-commercial-project--可以在商业项目中使用吗#Q: Can I use this in a commercial project? / 可以在商业项目中使用吗?":"A: Yes. This project is licensed under MPL-2.0. You can use it in closed-source commercial apps — if you use it unmodified, no source disclosure is required. If you modify the plugin's source files, those modified files must be published in source form under MPL-2.0 (your own app still does not need to be open-sourced).可以。本项目采用 MPL-2.0 许可证,可用于闭源商业 App——未修改直接使用时无需公开任何源码;若修改了插件源文件,被修改的文件必须以 MPL-2.0 公开源码(你自己的 App 仍无需开源)。","q-are-you-liable-for-issues-in-modified-versions--修改版出问题你们负责吗#Q: Are you liable for issues in modified versions? / 修改版出问题你们负责吗?":"A: This plugin is provided \"as is\", without warranty of any kind. The author assumes no responsibility or liability for the functionality, security, or any consequences arising from the use of modified versions or derivative projects.本插件按\"原样\"提供,不提供任何担保。作者不对修改版或衍生项目的功能、安全性及任何使用后果承担责任。"}},"/FPS-Viewer":{"title":"FPS Viewer / FPS 监控面板","data":{"":"The FPS Viewer provides real-time frame performance analysis, including current FPS, jank rate, frame duration stats, and an FPS trend chart.FPS 监控面板提供实时帧性能分析,包括当前 FPS、卡顿率、帧耗时统计和 FPS 趋势图。\nAvailable since v1.2.0v1.2.0 起可用","overview--概览#Overview / 概览":"The FPS Viewer is integrated into the inspector panel. Tap the floating inspector button → \"FPS\" tab to access.FPS 监控面板集成在检查器面板中。点击悬浮检查器按钮 → \"FPS\" 标签即可访问。⚠️ Important: FPS monitoring is off by default. You must toggle on the switch at the top of the panel to start collecting data.⚠️ 重要:FPS 监控默认关闭。必须在面板顶部打开开关才会开始采集数据。","master-switch--总开关#Master Switch / 总开关":"A switch at the top of the FPS panel controls whether monitoring is enabled.FPS 面板顶部有一个开关,控制是否启用监控。\nState\tBehavior\tOFF (default)\tNo frame timings callbacks, no timer, zero overhead / 无帧回调、无定时器、零开销\tON\tStarts collecting frame data via WidgetsBinding.instance.addTimingsCallback / 通过 addTimingsCallback 开始采集帧数据\t\nWhen turned off, all callbacks and timers are cancelled, leaving no residual overhead.关闭时所有回调和定时器会被取消,不会残留开销。","features--功能#Features / 功能":"","1-current-stats--当前统计#1. Current Stats / 当前统计":"Current FPS — Updated every 500ms / 每 500ms 更新\nJank Rate — Percentage of janky frames (duration exceeds the per-frame budget, derived from the display refresh rate) / 卡顿帧占比(帧耗时超过由屏幕刷新率换算的逐帧预算)\nTotal Frame Count — All frames captured since start / 自启动以来的总帧数\nTotal Janky Count — All janky frames captured / 自启动以来的总卡顿帧数\nLast Frame Janky — Whether the most recent frame was janky / 最近一帧是否卡顿\n显示当前 FPS、卡顿率、总帧数、总卡顿帧数、最近一帧是否卡顿。","2-fps-trend-chart--fps-趋势图#2. FPS Trend Chart / FPS 趋势图":"Real-time line chart with 30-second history window (60 data points × 500ms)\nY-axis dynamically scales to max(60, maxFps) to avoid overflow when FPS spikes\nJanky frame region marked in red\nTime axis labels: -30s / -15s / Now\n实时折线图,30 秒历史窗口(60 个数据点 × 500ms)。Y 轴动态缩放为 max(60, maxFps) 避免 FPS 飙升时溢出。卡顿区域以红色标记。","3-janky-frame-list--卡顿帧列表#3. Janky Frame List / 卡顿帧列表":"Lists janky frames — duration exceeds the per-frame budget, derived from the display refresh rate (~16.7ms at 60Hz, ~8.3ms at 120Hz) / 列出卡顿帧——帧耗时超过由屏幕刷新率换算的逐帧预算(60Hz≈16.7ms、120Hz≈8.3ms)\nEach item shows frame duration and timestamp, plus the build / raster split (buildDurationUs + rasterDurationUs) so you can tell whether build or GPU raster is the bottleneck / 每项显示帧耗时、时间戳,以及 build / raster 分项(buildDurationUs + rasterDurationUs),便于判断是构建还是 GPU 光栅化卡顿\nHelps identify specific jank spikes / 帮助定位具体卡顿点\n列出卡顿帧(帧耗时超过由屏幕刷新率换算的逐帧预算,60Hz≈16.7ms、120Hz≈8.3ms),每项显示帧耗时、时间戳与 build / raster 分项,帮助定位具体卡顿点。","4-reset--重置#4. Reset / 重置":"\"Reset\" button clears all statistics and historical data / \"Reset\" 按钮清空所有统计和历史数据\nUseful for measuring a specific interaction scenario / 适合测量特定交互场景\n\"Reset\" 按钮清空所有统计和历史数据,适合测量特定交互场景。","main-thread-blocking-watchdog--主线程阻塞看门狗#Main-thread Blocking Watchdog / 主线程阻塞看门狗":"The FPS panel also includes a main-thread blocking watchdog that catches stalls FPS cannot see.FPS 面板还内置主线程阻塞看门狗,专门捕捉 FPS 看不见的卡死。\nAvailable since v1.12.0v1.12.0 起可用\nWhy it's needed / 为什么需要: FPS only measures frames. When the UI isolate truly stalls (e.g. a synchronous heavy computation), it produces zero frames, so FPS reads as idle while the app is actually frozen. The watchdog closes that blind spot.FPS 只测帧。当 UI isolate 真正卡死(如同步重计算)时,它零帧产出,于是 FPS 显示空闲,而 App 其实已冻住。看门狗补上这个盲区。How it works / 工作原理:\nA low-frequency 100ms heartbeat measures the UI isolate's responsiveness directly / 用 100ms 低频心跳 直接测量 UI isolate 的响应间隔\nIf a gap exceeds 300ms with no response, it records a blocking event (duration / time / nearby logs) / 若超过 300ms 无响应,记录一条阻塞事件(时长 / 时间 / 附近日志)\nOff by default with its own switch (not tied to the FPS master switch) — zero overhead unless you opt in / 默认关闭、有独立开关(不随 FPS 总开关联动),不开启则零开销\n开启后,真正卡死(不产帧)也会被记成阻塞事件,配合 FPS 一起看因果。","how-it-works--工作原理#How It Works / 工作原理":"FPS monitoring uses Flutter's WidgetsBinding.instance.addTimingsCallback to receive frame timing information from the engine. The callback is batched — it may return multiple FrameTiming objects per call, so each frame is recorded individually inside the loop to ensure accurate FPS calculation.FPS 监控使用 Flutter 的 WidgetsBinding.instance.addTimingsCallback 接收引擎的帧时序信息。该回调是批量的——每次调用可能返回多个 FrameTiming 对象,因此在循环内部为每帧单独记录时间戳,确保 FPS 计算准确。Jank threshold / 卡顿阈值: A frame is janky when its total duration (build + raster) exceeds the per-frame budget — 1000ms ÷ refreshRate (≈16.7ms at 60Hz, ≈8.3ms at 120Hz). Since v1.11.0 the budget is derived from the device's refresh rate, so high-refresh (120Hz) screens are held to a tight ≈8.3ms instead of being forgiven by a fixed 16ms.卡顿阈值:帧的总耗时(build + raster)超过逐帧预算即视为卡顿——1000ms ÷ 刷新率(60Hz≈16.7ms、120Hz≈8.3ms)。自 v1.11.0 起预算按设备刷新率换算,高刷(120Hz)屏会被严格约束在 ≈8.3ms,而非被固定 16ms 放过。Phased timing / 分阶段耗时: Each FrameRecord carries buildDurationUs and rasterDurationUs (GPU raster); the janky-frame list shows the build / raster split per row.分阶段耗时:每条 FrameRecord 都带有 buildDurationUs 与 rasterDurationUs(GPU 光栅化),掉帧列表项会展示 build / raster 分项。","programmatic-control-optional--编程式控制可选#Programmatic Control (Optional) / 编程式控制(可选)":"If you need to start/stop monitoring from code (e.g., for automated testing), use FpsService:如需从代码控制监控(如自动化测试),使用 FpsService:\n// Start / Stop FPS monitoring / 开始 / 停止 FPS 监控\nFpsService.instance.start();\nFpsService.instance.stop();\n// Read current stats / 读取当前统计\nfinal fps = FpsService.instance.currentFps;\nfinal jankRate = FpsService.instance.jankRate;\nfinal totalFrames = FpsService.instance.totalFrameCount;\nfinal jankyFrames = FpsService.instance.totalJankyCount;\n// Clear historical data / 清空历史数据\nFpsService.instance.clear();\n// Listen to updates / 监听更新\nFpsService.instance.addListener(() {\n // Update your own UI / 更新你自己的 UI\n});\n// Historical data access / 历史数据访问\nfinal history = FpsService.instance.fpsHistory; // List, 60 entries / 60 条\nfinal records = FpsService.instance.frameRecords; // List, unmodifiable / 不可变,最多 3600 条","fpsservice-api--fpsservice-接口#FpsService API / FpsService 接口":"Singleton service extending ChangeNotifier.继承 ChangeNotifier 的单例服务。\nMethod\tDescription\tstart()\tStart FPS monitoring / 开始 FPS 监控\tstop()\tStop FPS monitoring / 停止 FPS 监控\tclear()\tClear all historical data and counters / 清空所有历史数据和计数器\t\nProperty\tType\tDescription\tisRunning\tbool\tWhether monitoring is currently active / 是否正在监控\tcurrentFps\tdouble\tCurrent FPS (updated every 500ms) / 当前 FPS(每 500ms 更新)\tjankRate\tdouble\tJank rate as percentage / 卡顿率(百分比)\ttotalFrameCount\tint\tTotal frames captured / 总帧数\ttotalJankyCount\tint\tTotal janky frames captured (per-frame budget) / 总卡顿帧数(按逐帧预算)\tlastFrameJanky\tbool\tWhether the most recent frame was janky / 最近一帧是否卡顿\tfpsHistory\tList\tRecent 60 FPS values (unmodifiable) / 最近 60 个 FPS 值(不可变)\tframeRecords\tList\tRecent frame records (unmodifiable, up to 3600) / 最近帧记录(不可变,最多 3600 条)","performance-considerations--性能说明#Performance Considerations / 性能说明":"Off by default / 默认关闭: Zero overhead when disabled / 关闭时零开销\nLightweight callbacks / 轻量回调: Only processes frame timing data, no heavy computation / 仅处理帧时序数据,无重计算\nBounded history / 有界历史: Trend chart keeps only 60 points, frame records capped at 3600 / 趋势图仅保留 60 个点,帧记录上限 3600 条\nSafe with other features / 与其他功能兼容: Can run alongside Memory Viewer monitoring / 可与 Memory Viewer 监控同时运行","platform-support--平台支持#Platform Support / 平台支持":"Feature\tAndroid\tiOS\tFPS Monitoring\t✅\t✅\tJank Detection\t✅\t✅\tTrend Chart\t✅\t✅\t\nFPS monitoring uses Flutter engine APIs and works on Android and iOS (the two platforms this plugin targets).FPS 监控使用 Flutter 引擎 API,在本插件支持的两个平台 Android 与 iOS 上均可用。","demo--演示#Demo / 演示":"The Example App includes an FPS demo module with three scenarios:Example App 包含 FPS 演示模块,提供三种场景:\nDemo\tDescription\tTrigger Jank\tBlocks the main thread for 100-500ms to simulate jank / 阻塞主线程 100-500ms 模拟卡顿\tHeavy Animations\t80 simultaneously rotating+scaling widgets to intentionally trigger jank / 80 个同时旋转+缩放的 widget 故意触发卡顿\tSmooth Animation\tSingle lightweight compound animation, demonstrates stable 60 FPS / 单个轻量复合动画,演示稳定 60 FPS","related--相关#Related / 相关":"Usage — General usage guide / 通用使用指南\nFAQ — Common questions / 常见问题\nConfiguration — Configuration options / 配置选项"}},"/Installation":{"title":"Installation / 安装","data":{"from-pubdev-recommended--从-pubdev-安装推荐#From pub.dev (Recommended) / 从 pub.dev 安装(推荐)":"Add the following to your pubspec.yaml:在 pubspec.yaml 中添加以下依赖:\ndependencies:\n zero_inspector_kit: ^1.13.0\nThen run:然后运行:\nflutter pub get","from-github--从-github-安装#From GitHub / 从 GitHub 安装":"Alternatively, install from GitHub:或者从 GitHub 安装:\ndependencies:\n zero_inspector_kit:\n git:\n url: https://github.com/zero-labsco/zero_inspector_kit.git\n ref: release/v1.13.0","platform-setup--平台配置#Platform Setup / 平台配置":"","android#Android":"No additional configuration needed.无需额外配置。","ios#iOS":"No additional configuration needed.无需额外配置。","import--导入#Import / 导入":"import 'package:zero_inspector_kit/zero_inspector_kit.dart';","requirements--环境要求#Requirements / 环境要求":"Requirement\tVersion\tFlutter\t>= 3.3.0\tDart SDK\t>= 3.11.0 < 4.0.0","next-steps--下一步#Next Steps / 下一步":"Getting Started — Quick start guide / 快速开始\nUsage — Full usage guide / 完整使用指南"}},"/Log-Viewer":{"title":"Log Viewer / 日志查看器","data":{"overview--概述#Overview / 概述":"The Log Viewer automatically captures logs from multiple sources with zero configuration.日志查看器自动从多个来源捕获日志,无需配置。","log-sources--日志来源#Log Sources / 日志来源":"Source\tCapture Method\tprint()\tZone specification override / Zone 规范覆盖\tdebugPrint()\tdebugPrint override / debugPrint 覆盖\tFlutter errors\tFlutterError.onError hook / 接管 FlutterError.onError\tUnhandled exceptions\trunZonedGuarded / runZonedGuarded 捕获\tThird-party libraries\tVia print() capture / 通过 print() 捕获\t\nSince v1.9.0, Flutter framework errors and unhandled exceptions are also aggregated & deduplicated in the dedicated Errors tab (keyed by type + stack signature) — while this Log Viewer keeps showing them as error-level lines in the chronological stream. Use Errors for \"is this crash repeating?\"; use Log Viewer for the raw timeline.自 v1.9.0 起,Flutter 框架异常与未捕获异常会同时进入独立的 Errors 标签页去重聚合(按类型 + 堆栈签名归并);本 Log Viewer 仍会在原始时间流中把它们显示为错误级日志。回答\"该崩溃是否反复出现\"请用 Errors;查看原始时间线请用 Log Viewer。","log-levels--日志级别#Log Levels / 日志级别":"Level\tAbbreviation\tColor\tDescription\tVerbose\tV\tGray\tDetailed information / 详细信息\tDebug\tD\tBlue\tDebug information / 调试信息\tInfo\tI\tGreen\tGeneral information / 一般信息\tWarning\tW\tOrange\tWarning messages / 警告信息\tError\tE\tRed\tError messages / 错误信息\t\nThird-party library logs are categorized as Info level.\n第三方日志库的日志统一归类为 Info 级别。","ui-features--ui-功能#UI Features / UI 功能":"","filter-bar--过滤栏#Filter Bar / 过滤栏":"All: Show all logs / 使用 All 显示所有日志\nV / D / I / W / E: Filter by level / 按级别过滤\nTag dropdown: Filter by any captured tag / 按任意已捕获标签过滤\nSingle-select mode / 单选模式","toolbar--工具栏#Toolbar / 工具栏":"Auto-scroll toggle (default on): Jump to the newest log as new entries arrive; pause to keep history still for inspection / 自动滚动开关(默认开启):新日志到达时自动跳到最新;暂停可稳定查看历史\nCopy as JSON: Copy all currently filtered logs as JSON / 复制为 JSON:将当前过滤后的全部日志复制为 JSON\nShare as Text: Share filtered logs as plain text / 分享为文本:将过滤后的日志以纯文本分享\nClear: Clear all logs / 清除:清空全部日志","log-list--日志列表#Log List / 日志列表":"Level badge with color / 带颜色的级别徽章\nTimestamp display / 时间戳显示\nTag display (if available) / 标签显示(如有)\nError/warning rows have subtle background tint / 错误/警告行有淡色背景\nLeft border color indicates level / 左侧边框颜色表示级别\nTap a row to open the in-view detail page with full message and copy; use the back button to return / 点击行进入详情页(主视图内切换),可查看完整消息并复制,点返回按钮回到列表\nPer-row copy button copies that single log as JSON / 行内复制按钮将该条日志以 JSON 复制","search--搜索#Search / 搜索":"Fuzzy search by message content or tag / 按消息内容或标签模糊搜索\nToggle regex mode (. * button) to search with RegExp (case-insensitive); invalid patterns degrade gracefully instead of crashing / 点击 正则模式(. * 按钮)使用 RegExp 搜索(不区分大小写);非法图案优雅降级,不会崩溃\nCombined with level and tag filters / 可与级别、标签过滤组合使用","manual-logging--手动记录日志#Manual Logging / 手动记录日志":"Quick shorthand (recommended) / 简化写法(推荐) — available since v1.1.2 / v1.1.2 起可用:\nInspectorLog.v('Verbose message / 详细消息');\nInspectorLog.d('Debug message / 调试消息');\nInspectorLog.i('Info message / 信息消息');\nInspectorLog.w('Warning message / 警告消息');\nInspectorLog.e('Error message / 错误消息');\n// With tag / 带标签\nInspectorLog.i('User logged in', tag: 'Auth');\nFull form / 完整写法:\nInspectorLogInterceptor.instance.verbose('Verbose message / 详细消息');\nInspectorLogInterceptor.instance.debug('Debug message / 调试消息');\nInspectorLogInterceptor.instance.info('Info message / 信息消息');\nInspectorLogInterceptor.instance.warning('Warning message / 警告消息');\nInspectorLogInterceptor.instance.error('Error message / 错误消息');\n// With tag / 带标签\nInspectorLogInterceptor.instance.info('User logged in', tag: 'Auth');\nInspectorLog is a static wrapper around InspectorLogInterceptor.instance for shorter log calls.InspectorLog 是 InspectorLogInterceptor.instance 的静态包装,用于更简短的日志调用。","third-party-library-integration--第三方日志库集成#Third-Party Library Integration / 第三方日志库集成":"","auto-capture-inbound--自动捕获入站#Auto-Capture (Inbound) / 自动捕获(入站)":"No configuration needed. Any library using print() or debugPrint() is automatically captured.无需配置。任何使用 print() 或 debugPrint() 的库都会被自动捕获。","bidirectional-sync-optional--双向同步可选#Bidirectional Sync (Optional) / 双向同步(可选)":"To forward inspector logs to your third-party logger:将检查器日志转发到第三方日志库:\nimport 'package:logger/logger.dart';\nfinal logger = Logger();\nInspectorLogInterceptor.instance.onLogCaptured = (entry) {\n logger.log(\n _mapLogLevel(entry.level),\n '${entry.tag != null ? '[${entry.tag}] ' : ''}${entry.message}',\n );\n};\nNote: Do NOT call logging methods inside onLogCaptured, as this will cause infinite recursion.\n注意:不要在 onLogCaptured 内部调用日志方法,否则会导致无限递归。","starting-the-log-interceptor--启动日志拦截器#Starting the Log Interceptor / 启动日志拦截器":"If using runAppWithInspector(), the log interceptor starts automatically. Otherwise:如果使用 runAppWithInspector(),日志拦截器会自动启动。否则:\nInspectorLogInterceptor.instance.start();"}},"/Getting-Started":{"title":"Getting Started / 快速开始","data":{"quick-start--快速开始#Quick Start / 快速开始":"Integrate with just 1 line of code:仅需 1 行代码 即可完成集成:\nimport 'package:flutter/material.dart';\nimport 'package:zero_inspector_kit/zero_inspector_kit.dart';\nvoid main() {\n // Single line: Initialize inspector, capture print() via Zone, and display floating button\n // 一行代码:初始化检查器、通过 Zone 捕获 print()、自动显示悬浮按钮\n ZeroInspectorKit.runAppWithInspector(const MyApp());\n}\nclass MyApp extends StatelessWidget {\n const MyApp({super.key});\n @override\n Widget build(BuildContext context) {\n return MaterialApp(\n home: Scaffold(\n appBar: AppBar(title: const Text('App')),\n body: const Center(child: Text('Hello World')),\n ),\n );\n }\n}","what-happens-automatically--自动完成的工作#What Happens Automatically / 自动完成的工作":"After integration, the inspector automatically does the following without modifying any other project code:集成后,检查器会自动完成以下工作,无需修改项目其他代码:\nFeature\tDescription\t✅ Log Capture\tAuto-capture all print(), debugPrint() via Zone / 通过 Zone 自动捕获所有日志\t✅ Network Interception\tAuto-intercept all http and Dio requests via HttpOverrides / 自动拦截所有网络请求\t✅ Error Capture\tAggregate Flutter framework errors & unhandled exceptions, deduped by type + stack (Errors tab) / 聚合 Flutter 框架异常与未捕获异常,按类型+堆栈去重\t✅ Session Persistence\tFlush logs/network/errors to a disk ring buffer; logs & errors replay on next launch / 日志/网络/异常落盘环形缓冲,启动时回放日志与异常\t✅ Database Scan\tAuto-scan and register SQLite databases / 自动扫描注册数据库\t✅ Floating Button\tAuto-displayed via Overlay, not affected by keyboard / 通过 Overlay 自动显示\t✅ Route Tracking\tAuto-inject InspectorRouteObserver into MaterialApp / 自动注入路由观察者\t\nNote / 说明: The Memory and FPS panels are available as tabs but are off by default to avoid performance overhead. Toggle the switch at the top of each panel to start collecting data. See Memory Viewer and FPS Viewer for details.Memory 和 FPS 面板作为标签页可用,但默认关闭以避免性能开销。在各自面板顶部打开开关才会开始采集数据。详见 Memory Viewer 和 FPS Viewer。\nPre-initialized binding / 提前初始化的 binding: If you call WidgetsFlutterBinding.ensureInitialized() or await a platform-channel plugin (e.g. SharedPreferences) before runAppWithInspector(), the binding is already initialized. In that case runAppWithInspector() degrades gracefully to a plain runApp() (capturing debugPrint logs, but not raw print()) instead of throwing a \"Zone mismatch\" assertion. No extra setup is needed.binding 已提前初始化:如果你在 runAppWithInspector() 之前调用了 WidgetsFlutterBinding.ensureInitialized() 或 await 了会触发 platform channel 的插件(如 SharedPreferences),binding 已被初始化。此时 runAppWithInspector() 会优雅降级为普通 runApp()(仍捕获 debugPrint 日志,但不捕获原始 print()),而非抛出 \"Zone mismatch\" 断言。无需额外处理。","production-build--生产构建#Production Build / 生产构建":"The inspector is automatically disabled in release mode. You don't need to remove any code — Flutter's tree-shaking will remove all inspector-related code from production builds.检查器在 release 模式下会自动禁用,无需移除任何代码,Flutter 的 tree-shaking 会自动移除所有检查器相关代码。","alternative-integration--替代集成方式#Alternative Integration / 替代集成方式":"If you prefer more control, use the two-line approach:如果需要更多控制权,可以使用两行代码方式:\nvoid main() {\n ZeroInspectorKit.init();\n runApp(ZeroInspectorKit.wrapApp(const MyApp()));\n}","next-steps--下一步#Next Steps / 下一步":"Installation — Detailed installation methods / 详细安装方式\nUsage — Full usage guide / 完整使用指南\nConfiguration — Configuration options / 配置选项"}},"/Memory-Viewer":{"title":"Memory Viewer / 内存监控面板","data":{"":"The Memory Viewer provides comprehensive in-app memory analysis, including trend charts, Dart Heap details, Native memory breakdown, memory leak detection, image cache monitoring, and storage statistics.内存监控面板提供应用内全面内存分析,包括趋势图、Dart Heap 详情、Native 内存分项、内存泄漏检测、图片缓存监控和存储统计。\nAvailable since v1.1.0v1.1.1 起可用","overview--概览#Overview / 概览":"The Memory Viewer is integrated into the inspector panel. Tap the floating inspector button → \"Memory\" tab to access.内存监控面板集成在检查器面板中。点击悬浮检查器按钮 → \"Memory\" 标签即可访问。⚠️ Important: Memory monitoring is off by default. You must toggle on the switch at the top of the panel to start collecting data.⚠️ 重要:内存监控默认关闭。必须在面板顶部打开开关才会开始采集数据。","master-switch--总开关#Master Switch / 总开关":"A switch at the top of the Memory panel controls whether monitoring is enabled.Memory 面板顶部有一个开关,控制是否启用监控。\nState\tBehavior\tOFF (default)\tNo timers, no VM Service connection, zero overhead / 无定时器、无 VM Service 连接、零开销\tON\tStarts RSS collection (500ms), Native memory (3s), storage stats (3s), leak detection (2s), and VM Service connection attempt / 启动 RSS 采集(500ms)、Native 内存(3s)、存储统计(3s)、泄漏检测(2s),并尝试连接 VM Service\t\nWhen turned off, all timers are cancelled and the VM Service connection state is cleared, leaving no residual WebSocket overhead.关闭时所有定时器会被取消,VM Service 连接状态会被清空,不会残留 WebSocket 开销。","features--功能#Features / 功能":"","1-memory-trend-chart--内存趋势图#1. Memory Trend Chart / 内存趋势图":"Real-time line chart with 2-minute history window (240 snapshots × 500ms)\nSwitchable between 4 metrics via the metric selector chips:\nProcess RSS — Process-level RSS (always available)\nDart Heap — Total Dart Heap usage (requires VM Service)\nNew Space — New generation usage (requires VM Service)\nOld Space — Old generation usage (requires VM Service)\n实时折线图,2 分钟历史窗口(240 条快照 × 500ms)。可通过指标选择芯片切换 4 种指标。","2-native-memory--native-内存真机-100-可用#2. Native Memory / Native 内存(真机 100% 可用)":"Does not depend on VM Service. Data is collected via Platform Channel:不依赖 VM Service,通过 Platform Channel 采集:Android (Debug.MemoryInfo + /proc/self/status):\nTotal PSS / Dalvik PSS / Native PSS / Native Private Dirty\nProcess RSS (from /proc/self/status)\nDevice memory status (availMem, threshold, lowMemory)\niOS (mach task_info):\nPhysical Footprint (Apple's recommended metric)\nInternal / Compressed / Resident Size\nProcess RSS\nDevice available memory","3-dart-heap-overview--dart-heap-概览需要-vm-service#3. Dart Heap Overview / Dart Heap 概览(需要 VM Service)":"Heap Usage / Capacity / external usage\nProgress bar showing heap usage ratio\nThree core metrics with bilingual labels\n显示 Heap Usage / Capacity / External 三个核心指标 + 进度条。","4-heap-generations--堆分代详情需要-vm-service#4. Heap Generations / 堆分代详情(需要 VM Service)":"New Space: usage / capacity / external\nOld Space: usage / capacity / external\nHelps identify allocation patterns (frequent new-space churn vs old-space growth)\n显示新生代/老生代的 Usage / Capacity / External 详细数据。","5-manual-gc--手动触发-gc需要-vm-service#5. Manual GC / 手动触发 GC(需要 VM Service)":"\"Trigger GC\" button forces a full garbage collection\nDisabled (grayed out) when VM Service is unavailable\n\"Trigger GC\" 按钮强制触发完整垃圾回收。VM Service 不可用时按钮变灰禁用。","6-memory-leak-detection--内存泄漏检测#6. Memory Leak Detection / 内存泄漏检测":"Based on Dart 2.17+ WeakReference and Finalizer. Does NOT depend on VM Service.基于 Dart 2.17+ 的 WeakReference 和 Finalizer,不依赖 VM Service。Four-state transition / 四状态流转:\nState\tMeaning\ttracking\tObject registered, waiting for expected release time / 对象已注册,等待预期释放时间\tverifying\tExceeded expected release time, GC verification triggered (if VM Service available) / 超过预期释放时间,触发 GC 验证(VM Service 可用时)\tleaked\tObject still exists after GC — suspected leak / GC 后对象仍存在——疑似泄漏\treleased\tObject has been garbage collected / 对象已被垃圾回收\t\nAPI / 接口:Quick shorthand (recommended) / 简化写法(推荐) — available since v1.1.2 / v1.1.2 起可用:\n// Extension method on Object / Object 上的扩展方法\nmyBloc.trackMemoryLeak(tag: 'HomePage_myBloc');\n// Or top-level function / 或使用顶层函数\ntrackMemoryLeak(myBloc, tag: 'HomePage_myBloc');\n// Cancel tracking / 取消追踪\nmyBloc.untrackMemoryLeak();\nFull form / 完整写法:\n// Register an object for leak tracking / 注册对象进行泄漏追踪\nMemoryInspectorService.instance.trackObject(\n myController,\n tag: 'HomeController_textController', // optional identifier\n expectedReleaseAfter: const Duration(seconds: 30), // expected release time\n);\n// Stop tracking a specific object / 停止追踪特定对象\nMemoryInspectorService.instance.untrackObject(myController);\n// Clear all records / 清空所有记录\nMemoryInspectorService.instance.clearLeakRecords();\nLimits / 限制:\nMax 500 tracked objects (LRU eviction)\nDetection interval: 2 seconds\ntrackObject() requires user code modification (mild invasion)\nFlutter MemoryAllocations bridge (since v1.9.0) / 官方泄漏追踪桥接(v1.9.0 起)The WeakReference state machine has a blind spot: an object whose dispose() ran but that has not been GC'd yet still resolves through the weak reference, producing a false \"leaked\" verdict. Since v1.9.0, MemoryInspectorService also subscribes to Flutter's official FlutterMemoryAllocations (the data source behind leak_tracker) via LeakTrackerBridge: once the official stream reports disposed, the object is treated as released (awaiting GC) even if the weak reference still resolves — cutting false positives. Enabled by default through enableFlutterLeakTracker in init(), and toggled in code via MemoryInspectorService.instance.flutterLeakTrackerEnabled.WeakReference 状态机有一个盲点:对象已调用 dispose() 但尚未被 GC 时弱引用仍存活,会产生\"疑似泄漏\"的误报。v1.9.0 起,MemoryInspectorService 通过 LeakTrackerBridge 额外订阅 Flutter 官方的 FlutterMemoryAllocations(leak_tracker 背后的数据源):只要官方上报 disposed,即便弱引用仍存活也判定为已释放(等待 GC),从而显著降低误报。由 init() 的 enableFlutterLeakTracker 默认启用,也可用 MemoryInspectorService.instance.flutterLeakTrackerEnabled 在代码中开关。","7-image-cache--图片缓存#7. Image Cache / 图片缓存":"Real-time Flutter image cache size and count\nPending (loading) / Live (in use) image counts\nOne-click clear all image cache\n实时显示 Flutter 图片缓存大小、数量、加载中/使用中状态。一键清理图片缓存。","8-app-storage--应用存储#8. App Storage / 应用存储":"Documents directory size\nTemp cache directory size\nTotal database file size\nOne-click clear temp cache\n显示文档目录、临时缓存、数据库文件大小。一键清理临时缓存。","️-vm-service-availability--vm-service-可用性#⚠️ VM Service Availability / VM Service 可用性":"Dart Heap data and manual GC require VM Service connection. When VM Service is unavailable, these features gracefully degrade to show \"N/A\".Dart Heap 数据和手动 GC 需要 VM Service 连接。 VM Service 不可用时,这些功能优雅降级显示 \"N/A\"。","when-debugging-via-pc-with-flutter-run--通过-pc-用-flutter-run-调试时#When debugging via PC with flutter run / 通过 PC 用 flutter run 调试时":"Dart VM Heap data may be unavailable (VM: OFF).Dart VM Heap 数据可能不可用(VM: OFF)。Reason / 原因: When using flutter run to debug via PC, the flutter tool sets up port forwarding between PC and device via adb reverse, allowing PC-side DevTools to access the device's VM Service. However, Service.getInfo() returns a serverUri from the PC's perspective; when the app process internally accesses 127.0.0.1:PC_port, the device doesn't have that port listening locally, resulting in Connection refused and VM Service showing OFF.原因:使用 flutter run 连接 PC 调试时,flutter tool 会通过 adb reverse 在 PC 和设备之间做端口转发,让 PC 上的 DevTools 能访问设备的 VM Service。但应用进程内部 Service.getInfo() 返回的 serverUri 是 PC 视角的端口,应用进程访问 127.0.0.1:PC端口 时设备本地并没有监听该端口,导致 Connection refused,VM Service 显示 OFF。","when-opening-debug-app-directly-no-pc--直接打开-debug-应用不连-pc#When opening debug app directly (no PC) / 直接打开 debug 应用(不连 PC)":"VM Service works normally. No flutter tool is involved, VM Service listens directly on the device's local port, the app can connect normally, and Dart Heap data displays correctly.VM Service 正常工作。 没有 flutter tool 介入,VM Service 直接监听设备本地端口,应用能正常连接,Dart Heap 数据正常显示。","fallback--降级方案#Fallback / 降级方案":"When VM Service is unavailable:\n✅ Native memory (Android PSS / iOS physicalFootprint) — still available\n✅ Process RSS — always available\n✅ Image cache / storage stats — still available\n✅ Leak detection — still available (doesn't depend on VM Service)\n❌ Dart Heap details — shows N/A\n❌ Manual GC — button disabled","platform-support--平台支持#Platform Support / 平台支持":"Feature\tAndroid\tiOS\tProcess RSS\t✅\t✅\tNative Memory\t✅\t✅\tDart Heap (VM Service)\t✅ (no PC)\t✅ (no PC)\tManual GC\t✅ (no PC)\t✅ (no PC)\tLeak Detection\t✅\t✅\tImage Cache\t✅\t✅\tStorage Stats\t✅\t✅","refresh-intervals--刷新间隔#Refresh Intervals / 刷新间隔":"Data Source\tInterval\tProcess RSS / Dart Heap\t500ms\tNative Memory (Android/iOS)\t3000ms\tStorage Stats\t3000ms\tLeak Detection\t2000ms","related--相关#Related / 相关":"Usage — General usage guide\nFAQ — Common questions\nConfiguration — Configuration options"}},"/Route-Tracker":{"title":"Route Tracker / 路由追踪","data":{"overview--概述#Overview / 概述":"The Route Tracker monitors navigation history, recording all route push, pop, and replacement events.路由追踪器监控导航历史,记录所有路由 push、pop 和替换事件。","auto-injection--自动注入#Auto-Injection / 自动注入":"When using runAppWithInspector() or wrapApp(), the InspectorRouteObserver is automatically injected into MaterialApp's navigatorObservers.使用 runAppWithInspector() 或 wrapApp() 时,InspectorRouteObserver 会自动注入到 MaterialApp 的 navigatorObservers 中。","tracked-route-actions--追踪的路由操作#Tracked Route Actions / 追踪的路由操作":"Action\tColor\tDescription\tpush\tBlue\tNavigator.push() / 推入新路由\tpushNamed\tBlue\tNavigator.pushNamed() / 按名称推入\tpop\tOrange\tNavigator.pop() / 弹出路由\tpopUntil\tOrange\tNavigator.popUntil() / 弹出直到\tpushReplacement\tPurple\tNavigator.pushReplacement() / 替换路由","ui-features--ui-功能#UI Features / UI 功能":"","route-list--路由列表#Route List / 路由列表":"Action badge with color / 带颜色的操作徽章\nRoute name display / 路由名称显示\nTimestamp display / 时间戳显示\nLeft border color indicates action type / 左侧边框颜色表示操作类型","route-detail--路由详情#Route Detail / 路由详情":"Click a route to view details / 点击路由查看详情\nShows: Action, Route Name, Timestamp, Arguments / 显示:操作、路由名、时间戳、参数\nArguments displayed as formatted JSON / 参数以 JSON 格式显示","manual-setup-optional--手动设置可选#Manual Setup (Optional) / 手动设置(可选)":"If you use a custom Navigator or don't use MaterialApp, add the observer manually:如果使用自定义 Navigator 或不使用 MaterialApp,请手动添加观察者:\nMaterialApp(\n navigatorObservers: [InspectorRouteObserver()],\n home: MyHomePage(),\n)"}},"/Network-Inspector":{"title":"Network Inspector / 网络检查器","data":{"overview--概述#Overview / 概述":"The Network Inspector automatically captures all HTTP requests made via the http package and Dio, with zero configuration needed.网络检查器自动捕获所有通过 http 包 和 Dio 发送的 HTTP 请求,无需任何配置。","how-it-works--工作原理#How It Works / 工作原理":"The inspector uses Flutter's HttpOverrides to intercept all HTTP traffic at the dart:io level. This means:检查器通过 Flutter 的 HttpOverrides 在 dart:io 层面拦截所有 HTTP 流量。这意味着:\nhttp package: Auto-captured ✅ / 自动捕获 ✅\nDio: Auto-captured (uses IOHttpClientAdapter → HttpClient) ✅ / 自动捕获 ✅\nNo manual interceptor setup needed / 无需手动添加拦截器","websocket--grpc-capture--websocket-与-grpc-抓取#WebSocket & gRPC Capture / WebSocket 与 gRPC 抓取":"Available since v1.7.0 (opt-in, off by default)v1.7.0 起可用(可选开启,默认关闭)\nHTTP/HTTPS traffic is captured automatically, but the HttpOverrides interceptor does not cover streaming protocols like WebSocket and gRPC. For those, enable the opt-in capture so frames and calls show up as WS / gRPC rows in the Network tab.HTTP/HTTPS 流量会自动捕获,但 HttpOverrides 拦截器无法覆盖 WebSocket、gRPC 这类流式协议。针对它们需开启可选的抓取,开启后收发帧/调用会以 WS / gRPC 行的形式出现在 Network 标签页。","enable--开启方式#Enable / 开启方式":"Toggle the WS switch in the Network tab toolbar, or / 在 Network 标签页工具栏点击 WS 开关,或\nSet it programmatically: / 通过代码开启:\n// on / 开启\nWsInspectorService.instance.enable();\n// off / 关闭\nWsInspectorService.instance.disable();\nCapture is off by default and only records while enabled — apps that don't use these protocols pay nothing.抓取默认关闭,且只在开启时记录;不使用这类协议的应用零开销。","two-usage-modes--两种使用方式#Two Usage Modes / 两种使用方式":"1. Transparent wrapper — InspectorWebSocketReplace WebSocket.connect with InspectorWebSocket.connect. Frames are auto-recorded (→ out, ← in) when capture is on; when off it passes through with zero overhead.将 WebSocket.connect 替换为 InspectorWebSocket.connect。开启抓取时会自动记录收发帧(→ 出站、← 入站);关闭时零开销透传。\nfinal ws = await InspectorWebSocket.connect('wss://echo.websocket.events');\nws.listen((msg) => print('received: $msg'));\nws.add('hello'); // recorded as an outgoing frame / 记录为出站帧\n2. Manual hook — recordCallFor stacks not transparently interceptable by dart:io (gRPC, web_socket_channel, custom protocols), call recordCall to log a request/response pair. No-ops when capture is disabled.对于无法被 dart:io 透明拦截的栈(gRPC、web_socket_channel、自定义协议),调用 recordCall 记录一次请求/响应。关闭抓取时为空操作。\nWsInspectorService.instance.recordCall(\n name: 'user.UserService/GetUser',\n request: '{ \"id\": 1 }',\n response: '{ \"name\": \"Ada\" }',\n protocol: 'gRPC', // appears in the method column / 显示在 method 列\n);","what-you-see--查看方式#What You See / 查看方式":"Network tab lists a WS (or gRPC) entry per connection/call / Network 标签页按连接/调用列出 WS(或 gRPC)记录\nOpen the detail view to see the frame log (outgoing → / incoming ←), accumulated in the response body / 进入详情页查看帧日志(出站 → / 入站 ←),累积显示在响应体中\nA [connection closed] marker is appended when the socket closes / 连接关闭后会追加 [connection closed] 标记","captured-information--捕获的信息#Captured Information / 捕获的信息":"Field\tDescription\tMethod\tGET, POST, PUT, DELETE, PATCH\tURL\tFull request URL\tStatus Code\tHTTP response status code\tDuration\tRequest duration\tRequest Headers\tAll request headers\tRequest Body\tRequest payload (JSON formatted)\tResponse Body\tResponse payload (JSON formatted)\tHost\tParsed from URL","ui-features--ui-功能#UI Features / UI 功能":"","request-list--请求列表#Request List / 请求列表":"Color-coded by HTTP method / 按 HTTP 方法着色\nStatus code badge / 状态码徽章\nDuration display / 耗时显示\nLeft border color indicates status / 左侧边框颜色表示状态","request-detail--请求详情#Request Detail / 请求详情":"Click a request to enter detail view / 点击请求进入详情视图\nBack button to return to list / 返回按钮返回列表\nRequest and response sections / 请求和响应分段显示\nJSON formatted body / JSON 格式化显示","search--搜索#Search / 搜索":"Fuzzy search by URL or method / 按 URL 或方法模糊搜索\nSearch bar hidden in detail view / 详情视图隐藏搜索栏","batch-operations--批量操作#Batch Operations / 批量操作":"Available since v1.3.0v1.3.0 起可用\nThe request list supports a selection mode for operating on multiple requests at once.请求列表支持选择模式,可一次性操作多条请求。\nTap the selection icon in the toolbar to enter selection mode / 点击工具栏的选择图标进入选择模式\nCheck/uncheck items; a top batch bar shows Select all / Cancel / 勾选/取消勾选;顶部批量条提供全选 / 取消\nBatch \"Copy as cURL\": copies all selected requests as cURL commands / 批量「Copy as cURL」:将所有选中请求复制为 cURL 命令\nBatch delete: removes selected requests from the list / 批量删除:从列表中移除选中请求","export--sensitive-field-masking--导出与敏感字段遮蔽#Export & Sensitive-field Masking / 导出与敏感字段遮蔽":"Available since v1.3.0v1.3.0 起可用\nThe toolbar includes an eye toggle that controls whether sensitive headers are masked on export.工具栏包含眼睛开关,控制导出时是否遮蔽敏感请求头。\nDefault: off (fully visible) — cURL / JSON / HAR reflect the real request verbatim / 默认关闭(完整可见):cURL / JSON / HAR 原样反映真实请求\nOn: toCurl / netToJson / netToHar / copyNet / exportNetToFile mask these headers / 开启后:以下请求头被遮蔽:\nAuthorization, Cookie, Set-Cookie, Proxy-Authorization, X-Auth-Token, X-CSRF-Token, X-XSRF-Token\nThe detail page \"Copy as cURL\" / \"Copy as JSON\" follow the same toggle / 详情页「Copy as cURL」「Copy as JSON」跟随同一开关\nWhen masking is active, the snackbar notes (sensitive hidden) / 遮蔽开启时,snackbar 提示 (sensitive hidden)\nTip: keep masking on before pasting cURL/JSON into terminals, chat, or issue trackers to avoid leaking credentials.提示:将 cURL/JSON 粘贴到终端、聊天或 issue 前,建议开启遮蔽,避免凭据泄露。","copy-as-curl--复制为-curl#Copy as cURL / 复制为 cURL":"Available since v1.3.0v1.3.0 起可用\nFrom the request detail view, tap Copy as cURL to copy the request as a ready-to-run cURL command (method, URL, headers, body). Respects the sensitive-field masking toggle above.在请求详情页点击 Copy as cURL,即可将请求复制为可直接运行的 cURL 命令(方法、URL、请求头、请求体),并遵循上方的敏感字段遮蔽开关。","replay-editor--重放编辑器#Replay Editor / 重放编辑器":"Available since v1.11.0v1.11.0 起可用\nEvery request detail view has a replay action (↻ icon). It opens an editable sheet that lets you re-issue the captured request in-app and preview the response — handy for quickly re-running an endpoint without leaving the app.每个请求详情页都有重放操作(↻ 图标)。它会打开一个可编辑弹层,让你在 App 内重新发出该请求并预览响应——无需离开应用即可快速复跑某个接口。\nOnly the URL query parameters are editable — add / edit / remove key=value rows; the URL is rebuilt from them on send / 仅 URL 查询参数可编辑——可增删改 key=value 行,发送时用其重建 URL\nURL, request headers and request body are read-only by design (the captured values are re-sent verbatim) / URL、请求头与请求体按设计只读(以捕获到的原值原样重发)\nOn Send, the request is re-issued with the original method / headers / body and the edited query string; the sheet shows the returned status code, elapsed time, and a response preview / 点击 Send 后用原始方法 / 请求头 / 请求体加上修改后的查询串重新发出,弹层展示返回状态码、耗时与响应预览\nThis is distinct from the interceptor (which builds a durable modification rule applied to future matching requests). The replay editor makes a one-off call with editable query params — including GET requests, whose params can't be changed by the interceptor.它与拦截器不同(拦截器生成作用于后续匹配请求的持久规则)。重放编辑器发起的是一次性调用,仅查询参数可改——包括 GET 请求(其参数拦截器无法修改)。","status-code-colors--状态码颜色#Status Code Colors / 状态码颜色":"Range\tColor\tDescription\t2xx\tGreen\tSuccess / 成功\t3xx\tBlue\tRedirect / 重定向\t4xx\tOrange\tClient error / 客户端错误\t5xx\tRed\tServer error / 服务器错误","http-method-colors--http-方法颜色#HTTP Method Colors / HTTP 方法颜色":"Method\tColor\tGET\tBlue / 蓝色\tPOST\tGreen / 绿色\tPUT\tOrange / 橙色\tDELETE\tRed / 红色\tPATCH\tPurple / 紫色","usage-example--使用示例#Usage Example / 使用示例":"// http package - auto-captured / http 包 - 自动捕获\nfinal response = await http.get(\n Uri.parse('https://api.example.com/data'),\n);\n// Dio - auto-captured / Dio - 自动捕获\nfinal response = await dio.post(\n 'https://api.example.com/data',\n data: {'key': 'value'},\n);\nNo additional setup required! All requests will appear in the Network tab.无需额外配置!所有请求都会出现在 Network 标签页中。","request-interceptor--请求拦截修改#Request Interceptor / 请求拦截修改":"Available since v1.0.7 (response fields locked to read-only since v1.0.8)v1.0.7 起可用(v1.0.8 起响应字段锁定为只读)\nThe inspector supports intercepting and modifying network requests via rules. This is useful for testing different request parameters without modifying app code.检查器支持通过规则拦截并修改网络请求,适合在不修改应用代码的情况下测试不同的请求参数。","workflow--工作流程#Workflow / 工作流程":"Send a request normally (it will be captured in the Network panel) / 正常发送请求(会被捕获到 Network 面板)\nOpen the request detail and tap the Interceptor icon / 打开请求详情,点击拦截器图标\nConfigure the modification rule (URL pattern, HTTP method, request modifications) / 配置修改规则(URL 模式、HTTP 方法、请求修改)\nSave the rule — subsequent matching requests will use the modified parameters / 保存规则——后续匹配的请求将使用修改后的参数","supported-modifications--支持的修改#Supported Modifications / 支持的修改":"Field\tEditable\tNotes\tRequest Body\t✅\tOnly for requests with body (POST, PUT, PATCH, etc.) / 仅适用于有 body 的请求\tRequest Headers\t✅\tAdd / modify / remove headers / 新增 / 修改 / 删除请求头\tURL\t❌\tGrayed out, read-only / 灰色不可编辑\tResponse Status Code\t❌\tRead-only since v1.0.8 / v1.0.8 起只读\tResponse Body\t❌\tRead-only since v1.0.8 / v1.0.8 起只读\t\nThe interception edit panel only allows modifying the request body and request headers. Response fields (status code, response body) are grayed out and uneditable.拦截编辑面板仅允许修改请求体和请求头。响应字段(状态码、响应体)灰色不可编辑。","rule-matching--规则匹配#Rule Matching / 规则匹配":"URL pattern matching: exact match or regex / URL 模式匹配:精确匹配或正则匹配\nHTTP method filtering: GET, POST, PUT, DELETE, PATCH, HEAD, or Any / HTTP 方法过滤","why-get-requests-cannot-be-modified--为什么-get-请求不能修改#Why GET Requests Cannot Be Modified / 为什么 GET 请求不能修改":"The interceptor currently supports modifying request body and headers only / 拦截器目前仅支持修改请求体和请求头\nGET requests don't have a request body / GET 请求没有请求体\nModifying GET request parameters would require URL modification / 修改 GET 请求参数需要修改 URL\nURL modification may cause unexpected issues with request routing and parameter encoding / 修改 URL 可能导致请求路由和参数编码的意外问题\nGET request detail pages do not display interception edit buttons, making them unmodifiable.GET 请求详情页不显示拦截编辑按钮,因此无法修改。","master-toggle--拦截总开关#Master Toggle / 拦截总开关":"The interception master toggle is displayed only on the Network list page, not in the detail page / 拦截总开关只显示在 Network 列表页,不在详情页\nRules are only applied when modification mode is enabled / 规则仅在启用修改模式时生效\nWhen no rules are configured or rules are disabled, all requests are sent normally without any modification / 未配置规则或禁用规则时,所有请求正常发送,不做任何修改","rule-management--规则管理#Rule Management / 规则管理":"The network panel includes an interceptor rule editor where you can:网络面板包含拦截规则编辑器,可以:\nCreate / edit / delete rules / 创建 / 编辑 / 删除规则\nEnable / disable individual rules / 启用 / 禁用单条规则\nView rule status indicators in the request list / 在请求列表中查看规则状态标识"}},"/Timeline":{"title":"Timeline / 统一会话时间线","data":{"overview--概述#Overview / 概述":"The Timeline tab merges network, logs, errors, routes, and alerts into a single time-ordered stream, so you can see the full causal chain of a session at a glance — e.g. \"route push → two requests → error log → 5xx alert\". Each source keeps its own data; the Timeline view only merges them for display.统一会话时间线把网络、日志、异常、路由、告警归并为一条按时间排序的流,让你一眼看清一次会话的完整因果链——例如「路由跳转 → 两个请求 → error 日志 → 5xx 告警」。各来源的数据仍归属各自服务,时间线视图只做归并显示。\nAvailable since v1.12.0v1.12.0 起可用","where-to-find-it--入口#Where to find it / 入口":"Tap the floating inspector button → the Timeline tab (located after Routes and before Widgets in the panel).点击悬浮检查器按钮 → Timeline 标签页(位于面板中 Routes 之后、Widgets 之前)。","features--功能#Features / 功能":"","1-merged-stream--归并流#1. Merged stream / 归并流":"Network / Logs / Errors / Routes / Alerts appear interleaved by timestamp / 网络 / 日志 / 异常 / 路由 / 告警按时间戳交错排列\nEach entry shows its source icon, a colored left accent bar, timestamp, and a concise summary / 每条显示来源图标、左侧彩色强调条、时间戳与精炼摘要\nTap any entry to expand details (e.g. request URL/status, log level/message, route action/name) / 点击任意条目展开详情(如请求 URL/状态、日志级别/内容、路由操作/名称)\n把五类数据按时间归并,每条带来源图标、彩色强调条、时间戳与摘要,可点击展开。","2-per-source-filtering--逐来源筛选#2. Per-source filtering / 逐来源筛选":"Toggle each source on/off to focus on the ones you care about / 逐来源开关,只看关心的来源\nFiltering only hides entries from the merged view; underlying data is untouched / 筛选只隐藏归并视图中的条目,底层数据不受影响\n顶部可按来源开关自由筛选,归并显示内容随之变化,底层数据不变。","3-focus-n-seconds--n-秒聚焦#3. Focus ±N seconds / ±N 秒聚焦":"Tap any event to enter \"focus\" mode: the view keeps only events within ±N seconds of the anchor / 点击任意事件进入「聚焦」模式,仅保留锚点前后 ±N 秒内的事件\nWindow selector: 5s / 10s (default) / 30s / 窗口可选:5s / 10s(默认)/ 30s\nGreat for isolating the exact cause-effect around a failure (e.g. what happened right before a 5xx alert) / 适合隔离某次失败前后的精确因果(如 5xx 告警前到底发生了什么)\n点击任意事件即可「聚焦它前后 ±N 秒」,把噪音过滤掉,只留因果相关事件。","how-it-works--工作原理#How It Works / 工作原理":"View-only merge — TimelineService.build() reads from InspectorService (network / logs / errors), RouteTrackerService, and AlertService, sorts them by time, and tags each with its TimelineEventKind. It does not copy or own any data. / 仅视图归并:TimelineService.build() 从各服务读取数据、按时间排序并打上来源标签,不复制、不持有数据。\nZero cost when closed — no timers, no listeners, no polling while the panel is not open; the merge runs on demand when you open the Timeline tab. / 面板关闭时零开销:未打开面板时不跑定时器、不监听、不轮询,仅在打开 Timeline 时按需归并。\ncontextAround(anchor, window) — given an anchor event and a Duration window, returns the slice of events whose timestamp falls within [anchor - window, anchor + window], oldest-first. / 给定锚点事件与窗口时长,返回落在 [锚点 - 窗口, 锚点 + 窗口] 内的事件,按时间升序。","related--相关#Related / 相关":"Usage — General usage guide / 通用使用指南\nFPS Viewer — Includes the main-thread blocking watchdog / 含主线程阻塞看门狗\nRoute Tracker — Route tracking details / 路由追踪详情"}},"/":{"title":"Zero Inspector Kit","data":{"":"A powerful Flutter plugin for in-app developer console, providing real-time debugging tools including network request inspection, logging, error aggregation, database viewing, and route tracking.一个功能强大的 Flutter 插件,提供应用内开发者控制台,包括网络请求检查、日志记录、异常聚合、数据库查看和路由追踪。","-features--功能特性#✨ Features / 功能特性":"Feature\tDescription\tZero Invasion\tIntegrate with 1 line of code / 一行代码集成\tNetwork Inspector\tReal-time HTTP request viewing (http + Dio) / 实时网络请求查看\tLog Viewer\tAuto-capture print()/debugPrint() and third-party logs / 自动捕获日志\tErrors\tAggregate & dedupe crashes by type + stack, with count and first/last seen / 按类型+堆栈去重聚合崩溃,记录次数与首末次时间\tDatabase Viewer\tSQLite inspection with table data / 数据库查看\tMemory Viewer\tTrend chart, Dart Heap, Native memory, leak detection (incl. Flutter MemoryAllocations bridge) / 内存趋势图、Dart Heap、Native 内存、泄漏检测(含官方 MemoryAllocations 桥接)\tFPS Monitor\tReal-time FPS, jank rate, trend chart / 实时 FPS、卡顿率、趋势图\tRoute Tracker\tNavigation history tracking / 路由追踪\tSession Timeline\tUnified view of network/logs/errors/routes/alerts by time, with ±N-second focus / 网络/日志/异常/路由/告警按时间归并,支持 ±N 秒聚焦\tSession Persistence\tLogs/network/errors survive restarts via a disk ring buffer; logs & errors replay on launch; one-tap session archive export / 日志/网络/异常通过磁盘环形缓冲跨重启保留,启动时回放日志与异常;一键导出会话存档\tAlerts\tRule-based alerts (network/log/memory/FPS) with unread badge / 基于规则的告警(网络/日志/内存/FPS)与未读角标\tSensitive Masking & cURL\tMask secrets on export; one-click cURL copy; batch ops / 导出遮蔽敏感字段、一键复制 cURL、批量操作\tFuzzy Search\tSearch in all viewers / 各查看器模糊搜索\tCross-platform\tAndroid, iOS / 跨平台支持","-table-of-contents--目录#📚 Table of Contents / 目录":"Page\tDescription\tGetting Started\tQuick start guide / 快速开始\tInstallation\tHow to install / 安装方式\tUsage\tDetailed usage / 详细使用\tNetwork Inspector\tNetwork request viewing / 网络检查器\tLog Viewer\tLog capturing and viewing / 日志查看器\tErrors\tAggregated error viewing / 异常聚合查看\tDatabase Viewer\tDatabase inspection / 数据库查看器\tRoute Tracker\tRoute tracking / 路由追踪\tTimeline\tUnified session timeline / 统一会话时间线\tMemory Viewer\tMemory monitoring & leak detection / 内存监控与泄漏检测\tFPS Viewer\tFPS monitoring & jank detection / FPS 监控与卡顿检测\tAlerts\tRule-based alerting / 基于规则的告警\tConfiguration\tConfiguration options / 配置说明\tCustom Database Provider\tExtend database support / 自定义数据库提供者\tFAQ\tFrequently asked questions / 常见问题","-links--链接#🔗 Links / 链接":"GitHub\nOfficial Website\npub.dev","-license--许可证#📄 License / 许可证":"This project is licensed under the GNU General Public License v3.0.本项目采用 GNU General Public License v3.0 许可证。This plugin is provided \"as is\", without warranty of any kind. The author assumes no responsibility or liability for the functionality, security, or any consequences arising from the use of modified versions or derivative projects.本插件按\"原样\"提供,不提供任何担保。作者不对修改版或衍生项目的功能、安全性及任何使用后果承担责任。"}},"/Usage":{"title":"Usage / 使用指南","data":{"integration-methods--集成方式#Integration Methods / 集成方式":"","1-one-line-integration-recommended--一行代码集成推荐#1. One-Line Integration (Recommended) / 一行代码集成(推荐)":"void main() {\n ZeroInspectorKit.runAppWithInspector(const MyApp());\n}\nThis method:\nAuto-initializes inspector / 自动初始化检查器\nCaptures print() via Zone / 通过 Zone 捕获 print()\nDisplays floating button via Overlay / 通过 Overlay 显示悬浮按钮\nAuto-injects route observer / 自动注入路由观察者","2-two-line-integration--两行代码集成#2. Two-Line Integration / 两行代码集成":"void main() {\n ZeroInspectorKit.init();\n runApp(ZeroInspectorKit.wrapApp(const MyApp()));\n}","inspector-panel--检查器面板#Inspector Panel / 检查器面板":"The inspector panel contains 10 tabs (as of v1.12.0):检查器面板包含 10 个标签页(v1.12.0 起):\nTab\tIcon\tFeature\tNetwork\t🌐\tHTTP request viewing + interceptor rules / 网络请求查看 + 拦截修改\tLogs\t📝\tLog viewing with level filter / 日志查看\tErrors\t🚨\tAggregated & deduped crash viewing / 去重聚合的异常查看\tDatabase\t💾\tDatabase and table inspection / 数据库查看\tMemory\t📊\tMemory trend, Dart Heap, Native memory, leak detection / 内存趋势、Dart Heap、Native 内存、泄漏检测\tFPS\t🎯\tReal-time FPS, jank rate, trend chart, plus main-thread blocking watchdog / 实时 FPS、卡顿率、趋势图,以及主线程阻塞看门狗\tRoutes\t🧭\tRoute navigation tracking / 路由追踪\tTimeline\t🧵\tUnified session timeline: network / logs / errors / routes / alerts merged into one stream, with ±N-second focus / 统一会话时间线:网络/日志/异常/路由/告警按时间归并,支持 ±N 秒聚焦\tWidgets\t🔍\tWidget tree snapshot for the current route / 当前路由的 Widget 树快照\tAlerts\t🔔\tRule-based alerts with unread badge / 基于规则的告警与未读角标\t\nThe Memory and FPS monitors are off by default to avoid performance overhead. Toggle the switch at the top of each panel to start collecting data.Memory 与 FPS 监控默认关闭以避免性能开销。在各自面板顶部打开开关才会开始采集数据。","one-click-bug-report--一键-bug-报告#One-Click Bug Report / 一键 Bug 报告":"Tap the bug icon in the inspector panel header to generate and share a bug report in one tap — ideal for QA to attach environment context when filing issues.点击检查器面板头部的虫子图标,即可一键生成并分享一份 Bug 报告——非常适合 QA 在提 issue 时附上环境上下文。The shared text snapshot includes / 分享的文本快照包含:\nDevice / 设备: real model (e.g. Pixel 8 Pro / iPhone (iPhone16,1)), OS & version, locale, Dart runtime, CPU cores.\nMemory / 内存: current heap usage and whether Native memory is supported.\nRecent logs / 最近日志: the latest captured log entries.\nRecent network / 最近网络: the latest captured requests.\nSensitive headers are masked the same way as in the Network tab. No data leaves the device except through the share target you choose.敏感请求头会与网络标签页一样被遮蔽。除你选择的分享目标外,数据不会离开设备。\nRequires no extra setup — it works as soon as the inspector is running. / 无需额外配置——检查器运行后即可使用。","floating-button--悬浮按钮#Floating Button / 悬浮按钮":"The floating button appears after 1 second delay / 悬浮按钮延迟 1 秒出现\nDrag to move it along the screen edge / 拖动 可沿屏幕边缘移动\nTap (when fully visible) to open/close the inspector panel / 点击(完全可见时)打开/关闭检查器面板\nButton auto-snaps to the nearest screen edge / 按钮自动吸附到最近的屏幕边缘\nBreathing animation when idle / 空闲时有呼吸动画","edge-docking-since-v120--边缘吸附v120-起#Edge Docking (since v1.2.0) / 边缘吸附(v1.2.0 起)":"When released near a screen edge, the button auto-docks and tucks into the edge, leaving only a 24px peek visible:拖动松手后,按钮会自动吸附到最近边缘并\"收入\"边缘,仅露出 24px 小弧边:\nState\tBehavior / 行为\tDocked (tucked in)\tOnly 24px peek visible; icon becomes a directional chevron (left dock → ➡, right dock → ⬅) hinting at tap-to-pull-out / 仅露出 24px;图标变为方向箭头提示可点击拉出\tTap docked peek\tSmoothly pulls out to fully visible (panel NOT opened, avoids accidental open) / 平滑拉出到完全可见(不打开面板,避免误触)\tTap fully visible\tOpens the inspector panel / 打开检查器面板\t\nThis design avoids conflicts with system back gestures (Android/iOS edge swipe to go back) when pulling out from the docked state.此设计避免了从吸附态拖出时与系统返回手势(Android/iOS 边缘右滑退出)的冲突。","search--搜索#Search / 搜索":"The main viewers support fuzzy search:各查看器均支持模糊搜索:\nViewer\tSearch Scope\tNetwork\tURL, HTTP method / URL、请求方法\tLogs\tMessage, tag / 消息、标签\tErrors\tException type, message / 异常类型、消息\tDatabase (global)\tDatabase name, table name / 数据库名、表名\tDatabase (in-database)\tTable name, all column data / 表名、所有列数据","manual-logging-optional--手动记录日志可选#Manual Logging (Optional) / 手动记录日志(可选)":"The inspector auto-captures print() output. You can also use manual log methods for precise level control:检查器会自动捕获 print() 输出。也可以使用手动日志方法进行精确级别控制:Quick shorthand (recommended) / 简化写法(推荐):\nInspectorLog.v('Verbose log / 详细日志');\nInspectorLog.d('Debug log / 调试日志');\nInspectorLog.i('Info log / 信息日志');\nInspectorLog.w('Warning log / 警告日志');\nInspectorLog.e('Error log / 错误日志');\nFull form / 完整写法:\nInspectorLogInterceptor.instance.verbose('Verbose log / 详细日志');\nInspectorLogInterceptor.instance.debug('Debug log / 调试日志');\nInspectorLogInterceptor.instance.info('Info log / 信息日志');\nInspectorLogInterceptor.instance.warning('Warning log / 警告日志');\nInspectorLogInterceptor.instance.error('Error log / 错误日志');","third-party-log-integration--第三方日志库集成#Third-Party Log Integration / 第三方日志库集成":"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 级别。","bidirectional-sync-optional--双向同步可选#Bidirectional Sync (Optional) / 双向同步(可选)":"To sync inspector-captured logs to your third-party logger:将检查器捕获的日志同步到第三方日志库:\nInspectorLogInterceptor.instance.onLogCaptured = (entry) {\n yourLogger.log(entry.message);\n};","feature-pages--功能详情#Feature Pages / 功能详情":"Network Inspector — Network request details + interceptor rules / 网络检查器详情 + 拦截修改\nLog Viewer — Log viewing details / 日志查看器详情\nErrors — Aggregated error viewing / 异常聚合查看\nDatabase Viewer — Database inspection details / 数据库查看器详情\nRoute Tracker — Route tracking details / 路由追踪详情\nMemory Viewer — Memory monitoring & leak detection / 内存监控与泄漏检测\nFPS Viewer — FPS monitoring & jank detection / FPS 监控与卡顿检测","session-persistence--会话持久化#Session Persistence / 会话持久化":"Logs, network requests, and aggregated errors are asynchronously flushed to a local SQLite ring buffer. On the next launch, logs and aggregated errors replay into their tabs; network requests stay archived on disk for later export. Data therefore survives app restarts even if the inspector panel was never opened. Tap the storage icon in the panel header to open the Persisted data manager: view row counts per category, export the full session archive, or clear the disk. See Configuration (PersistenceService section) for the API and tuning parameters.日志、网络请求与聚合异常会被异步写入本地 SQLite 环形缓冲。下次启动时,日志与聚合异常会回放入各自标签页;网络请求保留在磁盘存档,供之后导出。因此即使从未打开过检查器面板,数据也能跨重启保留。点击面板头部的存储图标可打开 Persisted data 管理弹层:查看各类别行数、导出完整会话存档或清空磁盘。API 与调参详见 Configuration(PersistenceService 一节)。"}}} \ No newline at end of file +{"/Alerts":{"title":"Alerts / 告警系统","data":{"overview--概述#Overview / 概述":"Available since v1.3.0v1.3.0 起可用\nThe alert system lets you define rules that proactively surface problems across network requests, logs, memory, and FPS — without manually scanning the panels.告警系统允许你定义规则,主动暴露网络请求、日志、内存、FPS 方面的问题,无需手动逐个面板排查。","how-it-works--工作原理#How It Works / 工作原理":"Rules are evaluated by AlertService whenever a relevant event occurs / 每当相关事件发生时,AlertService 会评估规则\nMatched rules produce alerts, and the unread count is exposed via a ValueNotifier / 命中的规则会生成告警,未读数通过 ValueNotifier 暴露\nThe floating button shows an unread-count badge; opening the panel clears it / 悬浮球显示未读数量角标,打开面板即清零\nAn Alerts tab in the inspector panel lists all triggered alerts / 检查器面板的 Alerts 标签页列出所有已触发的告警","rule-types--规则类型#Rule Types / 规则类型":"Type\tTrigger / 触发条件\tExample / 示例\tNetwork\tResponse status code / 响应状态码\tAlert when status ≥ 400 / 状态码 ≥ 400 时告警\tLog\tLog level or message / 日志级别或内容\tAlert on error logs / 出现 error 日志时告警\tMemory\tDart heap / Native memory threshold / 内存阈值\tAlert when Dart heap > 100 MB / Dart 堆 > 100 MB 时告警\tFPS\tFrame rate / 帧率\tAlert when FPS < 50 / FPS < 50 时告警","ui-features--ui-功能#UI Features / UI 功能":"","floating-button-badge--悬浮球角标#Floating Button Badge / 悬浮球角标":"A red badge shows the current unread alert count (clamped 0–99) / 红色角标显示当前未读告警数(0–99)\nThe number is drawn inside the button so it is never clipped at screen edges / 数字直接绘制在按钮内部,吸附屏幕边缘时不会被裁切\nOpening the inspector panel clears the unread count / 打开检查器面板即清零未读数","alerts-tab--alerts-标签页#Alerts Tab / Alerts 标签页":"Lists triggered alerts with type, condition, and timestamp / 列出已触发告警的类型、条件与时间\nTap an alert to jump to the related panel (network / log / memory / FPS) / 点击告警可跳转到相关面板(网络 / 日志 / 内存 / FPS)","notes--备注#Notes / 备注":"Alerts are evaluated in-process and shown in the developer console only; they do not send data off-device / 告警仅在本机开发者控制台内评估与展示,不会将数据发送到设备外\nPersisted to disk (since v1.11.0): triggered alerts are flushed to the SQLite ring buffer and replay into the Alerts tab after an app restart, and are included in the session archive export / 已落盘持久化(v1.11.0 起):已触发的告警会写入 SQLite 环形缓冲,重启后回放至 Alerts 标签页,并包含在会话存档导出中\nThe alert system is tree-shaken out in release builds, like the rest of the inspector / 与检查器其余部分一样,告警系统在 release 构建中被 tree-shake 移除"}},"/Configuration":{"title":"Configuration / 配置说明","data":{"zeroinspectorkitinit-parameters--初始化参数#ZeroInspectorKit.init() Parameters / 初始化参数":"Parameter\tType\tDefault\tDescription\tenable\tbool\ttrue\tEnable inspector (auto false in release mode) / 启用检查器\tenableLogCapture\tbool\ttrue\tEnable log capture / 启用日志捕获\tenableNetworkCapture\tbool\ttrue\tEnable network interception / 启用网络拦截\tenableErrorCapture\tbool\ttrue\tEnable error aggregation (Errors tab) / 启用异常聚合(Errors 标签页)\tenablePersistence\tbool\ttrue\tPersist logs/network/errors to a SQLite ring buffer; logs & errors replay on launch / 将日志/网络/异常落盘到 SQLite 环形缓冲,启动时回放日志与异常\tenableFlutterLeakTracker\tbool\ttrue\tBridge Flutter's official MemoryAllocations as a second leak-detection source / 桥接 Flutter 官方 MemoryAllocations 作为泄漏检测第二来源\tenableDatabaseScan\tbool\ttrue\tEnable database scan / 启用数据库扫描\tenableRouteTracking\tbool\ttrue\tEnable route tracking / 启用路由追踪\tenableWidgetInspector\tbool\ttrue\tEnable Widget tree snapshot / 启用 Widget 树快照\tenableNetworkTimeline\tbool\ttrue\tPrefer the network timeline (waterfall) in request details / 网络详情页默认展示时间轴(瀑布图)\tcustomButton\tWidget?\tnull\tCustom floating button widget / 自定义悬浮按钮\tonLogCaptured\tvoid Function(LogEntry)?\tnull\tLog capture callback for third-party integration / 日志捕获回调\tmaxNetworkItems\tint?\t100\tNetwork request cache cap / 网络请求缓存上限\tmaxLogItems\tint?\t500\tLog entry cache cap / 日志条目缓存上限\tmaxRouteItems\tint?\t200\tRoute record cache cap / 路由记录缓存上限\tmaxBodyPreviewBytes\tint?\t32KB\tBody preview cap, longer bodies truncated / body 预览字节上限,超出截断\t\nenableWidgetInspector / enableNetworkTimeline are also exposed on runAppWithInspector(). (wrapApp() takes only enable.)enableWidgetInspector / enableNetworkTimeline 也可在 runAppWithInspector() 上设置(wrapApp() 仅接受 enable)。","usage-examples--使用示例#Usage Examples / 使用示例":"","disable-specific-features--禁用特定功能#Disable Specific Features / 禁用特定功能":"ZeroInspectorKit.init(\n enableLogCapture: true,\n enableNetworkCapture: false, // Disable network monitoring / 禁用网络监控\n enableDatabaseScan: true,\n enableRouteTracking: false, // Disable route tracking / 禁用路由追踪\n);","with-log-callback--带日志回调#With Log Callback / 带日志回调":"ZeroInspectorKit.init(\n onLogCaptured: (entry) {\n // Forward to your logging service / 转发到你的日志服务\n myLogger.log(entry.message);\n },\n);","conditionalinspector--条件检查器组件#ConditionalInspector / 条件检查器组件":"A convenience widget that automatically shows/hides the inspector based on build mode.根据构建模式自动显示/隐藏检查器的便利组件。\nConditionalInspector(\n child: YourAppWidget(),\n)\nParameter\tType\tDefault\tDescription\tchild\tWidget\trequired\tChild widget / 子组件\tenabled\tbool\ttrue\tEnable inspector / 启用检查器","floatinginspectorbutton--悬浮检查器按钮#FloatingInspectorButton / 悬浮检查器按钮":"Parameter\tType\tDefault\tDescription\tenabled\tbool\ttrue\tEnable button (auto false in release mode) / 启用按钮","inspectorloginterceptor--日志拦截器#InspectorLogInterceptor / 日志拦截器":"Method\tDescription\tstart()\tStart capturing logs / 开始捕获日志\tstop()\tStop capturing logs / 停止捕获日志\tlog(level, message, tag)\tAdd a log entry / 添加日志条目\tverbose(message, tag)\tAdd verbose log / 添加详细日志\tdebug(message, tag)\tAdd debug log / 添加调试日志\tinfo(message, tag)\tAdd info log / 添加信息日志\twarning(message, tag)\tAdd warning log / 添加警告日志\terror(message, tag)\tAdd error log / 添加错误日志\t\nProperty\tType\tDescription\tonLogCaptured\tvoid Function(LogEntry)?\tCallback when a log is captured / 日志捕获回调","inspectorrouteobserver--路由观察者#InspectorRouteObserver / 路由观察者":"Navigator observer for tracking route changes. Auto-injected when using runAppWithInspector() or wrapApp().用于追踪路由变化的 Navigator 观察者。使用 runAppWithInspector() 或 wrapApp() 时自动注入。\nMaterialApp(\n navigatorObservers: [InspectorRouteObserver()],\n home: MyHomePage(),\n)","databaseregistry--数据库注册表#DatabaseRegistry / 数据库注册表":"Register custom database providers:注册自定义数据库提供者:\nDatabaseRegistry.instance.registerProvider(SqliteDatabaseProvider());\nSee Custom Database Provider for more details.详见 自定义数据库提供者。","inspectorlog--简化日志-api#InspectorLog / 简化日志 API":"Available since v1.1.2 / v1.1.2 起可用\nA static wrapper around InspectorLogInterceptor.instance for shorter log calls.InspectorLogInterceptor.instance 的静态包装,用于更简短的日志调用。\nInspectorLog.v('Verbose log');\nInspectorLog.d('Debug log');\nInspectorLog.i('Info log', tag: 'Auth');\nInspectorLog.w('Warning log');\nInspectorLog.e('Error log');\nMethod\tDescription\tstart()\tStart capturing logs / 开始捕获日志\tstop()\tStop capturing logs / 停止捕获日志\tlog(level, message, {tag})\tAdd a log entry / 添加日志条目\tv(message, {tag})\tAdd verbose log / 添加详细日志\td(message, {tag})\tAdd debug log / 添加调试日志\ti(message, {tag})\tAdd info log / 添加信息日志\tw(message, {tag})\tAdd warning log / 添加警告日志\te(message, {tag})\tAdd error log / 添加错误日志\t\nProperty\tType\tDescription\tisRunning\tbool\tWhether log capture is currently active / 日志捕获是否正在运行","memoryinspectorservice--内存监控服务#MemoryInspectorService / 内存监控服务":"Available since v1.1.0 / v1.1.0 起可用\nSingleton service for memory monitoring and leak detection, extends ChangeNotifier.内存监控与泄漏检测单例服务,继承 ChangeNotifier。","full-api--完整接口#Full API / 完整接口":"// Leak tracking (full form) / 泄漏追踪(完整写法)\nMemoryInspectorService.instance.trackObject(\n myController,\n tag: 'HomeController_textController',\n expectedReleaseAfter: const Duration(seconds: 30),\n);\nMemoryInspectorService.instance.untrackObject(myController);\nMemoryInspectorService.instance.clearLeakRecords();","simplified-api--简化接口#Simplified API / 简化接口":"Available since v1.1.2 / v1.1.2 起可用\n// Extension method on Object / Object 上的扩展方法\nmyBloc.trackMemoryLeak(tag: 'HomePage_myBloc');\n// Top-level function / 顶层函数\ntrackMemoryLeak(myBloc, tag: 'HomePage_myBloc');\n// Cancel tracking / 取消追踪\nmyBloc.untrackMemoryLeak();\nSee Memory Viewer for full feature details.完整功能详情见 Memory Viewer。","flutter-memoryallocations-bridge--官方泄漏追踪桥接#Flutter MemoryAllocations Bridge / 官方泄漏追踪桥接":"Available since v1.9.0 / v1.9.0 起可用\nThe leak detector's own WeakReference state machine has a blind spot: an object whose dispose() ran but which has not been GC'd yet still resolves through the weak reference and is flagged as a suspected leak (false positive). LeakTrackerBridge subscribes to Flutter's official FlutterMemoryAllocations (the data source behind leak_tracker) as a second source: once the official stream reports disposed, the object is treated as released (awaiting GC) even if the weak reference still resolves — cutting false positives.自研泄漏检测的 WeakReference 状态机有一个盲点:对象已调用 dispose() 但尚未被 GC 时,弱引用仍存活,会被判定为\"疑似泄漏\"(误报)。LeakTrackerBridge 订阅 Flutter 官方的 FlutterMemoryAllocations(leak_tracker 背后的数据源)作为第二来源:只要官方上报了 disposed,即便弱引用仍存活也判定为已释放(等待 GC),从而显著降低误报。\nEnabled by default via ZeroInspectorKit.init()'s enableFlutterLeakTracker / 通过 init() 的 enableFlutterLeakTracker 默认启用\nOfficial events only cover framework types that report to FlutterMemoryAllocations (Image / Picture / Layer …) — it supplements, not replaces, the custom detector / 官方事件只覆盖会上报给 FlutterMemoryAllocations 的框架类型(如 Image / Picture / Layer),因此是补充而非替代自研方案","errorservice--异常聚合服务#ErrorService / 异常聚合服务":"Available since v1.9.0 / v1.9.0 起可用\nSingleton service for aggregated error capture, extends ChangeNotifier. Hooks FlutterError.onError (keeping the default red error behavior) and dedups each exception by type + stack signature. See Errors for full feature details.异常聚合单例服务,继承 ChangeNotifier。接管 FlutterError.onError(保留默认红色报错行为),按类型 + 堆栈签名去重聚合。完整功能见 Errors。\n// Report an exception manually (gRPC / custom protocols) / 手动上报异常\nErrorService.instance.report(error, stackTrace, 'myModule');\n// Read aggregated records (newest first) / 读取聚合记录(最新在前)\nfinal ErrorRecord r = ErrorService.instance.errors.first;\n// Toggle capture / 切换抓取开关\nErrorService.instance.isEnabled = false;\n// Clear all records / 清空全部记录\nErrorService.instance.clear();\nMember\tDescription\terrors\tList — aggregated records, newest first / 聚合记录,最新在前\terrorCount\tint — aggregated record count / 聚合记录条数\tisEnabled\tbool — capture toggle (programmatic) / 抓取开关(代码控制)\treport(exception, stack, [context])\tManually report an exception / 手动上报异常\trestore(records)\tRestore persisted records (replay on launch) / 恢复持久化记录(启动回放)\tclear()\tClear all aggregated records / 清空所有聚合记录\tinstall() / uninstall()\tHook / restore FlutterError.onError / 接管 / 还原 FlutterError.onError","persistenceservice--持久化服务#PersistenceService / 持久化服务":"Available since v1.9.0 / v1.9.0 起可用\nSingleton service that async-flushes logs, network requests, and aggregated errors to a local SQLite ring buffer (zero_inspector_kit.db) so data survives app restarts. On launch, logs and aggregated errors replay into their tabs; network requests stay archived on disk for later export. Everything is guarded and degrades gracefully: if the DB is unavailable (e.g. desktop without sqflite FFI) isEnabled is false and writes become no-ops, never affecting the host app.单例服务,将日志、网络请求与聚合异常异步落盘到本地 SQLite 环形缓冲(zero_inspector_kit.db),使数据跨重启不丢。启动时日志与聚合异常回放入各自标签页;网络请求保留在磁盘存档,供之后导出。所有操作都有保护并优雅降级:数据库不可用(如桌面端未配置 sqflite FFI)时 isEnabled 为 false,写入变为空操作,绝不影响宿主应用。","tuning--调参#Tuning / 调参":"await PersistenceService.instance.init(\n maxRowsPerTable: 5000, // rows kept per table / 每表保留行数\n retention: const Duration(days: 7), // retention window / 保留时长\n flushInterval: const Duration(seconds: 2), // disk flush interval / 刷盘间隔\n);\nEnabled by default via ZeroInspectorKit.init()'s enablePersistence — the ring buffer flushes automatically, so no manual init() call is needed in normal use.通过 init() 的 enablePersistence 默认启用——环形缓冲会自动刷盘,常规使用无需手动调用 init()。\nMember\tDescription\tisEnabled\tbool — whether the DB is available / 数据库是否可用\tmaxRowsPerTable\tint — row cap per table (ring-buffer trim line) / 每表行数上限\tenqueueLog(e) / enqueueNetwork(r) / enqueueError(e)\tEnqueue an item for async flush / 入队待异步落盘\tflush()\tFlush the buffer to disk and trim / 刷盘并按环形缓冲裁剪\tloadLogs() / loadErrors() / loadNetworkJson()\tLoad persisted data, newest first / 读取已持久化数据(最新在前)\tbuildSessionArchiveJson()\tBuild the full-session archive JSON (logs + errors + network) / 构建完整会话存档 JSON\texportSessionArchiveAndShare()\tExport & share the full-session archive via the system share sheet / 导出并分享完整会话存档\tclearAll()\tClear persisted data on disk / 清空磁盘上的持久化数据\tdispose()\tFlush then close / 先刷盘再关闭","persisted-data-manager--持久化数据管理#Persisted Data Manager / 持久化数据管理":"Tap the storage icon in the panel header to open the Persisted data sheet: it shows the current row counts per category (logs / network / errors), the per-table cap, and whether the data will be replayed on the next launch. Actions:点击面板头部的存储图标打开 Persisted data 管理弹层:展示各类别当前行数(logs / network / errors)、每表上限,以及下次启动是否会回放。支持的操作:\nExport & share session archive — share a JSON snapshot of the whole session / 导出并分享会话存档——分享本次会话完整 JSON 快照\nClear disk — wipe persisted rows so the next launch replays nothing / 清空磁盘——清空持久化数据,下次启动干净\nClear disk & lists — wipe disk and the in-memory lists together / 同时清空磁盘与列表——连同内存列表一并清空","fpsservice--fps-监控服务#FpsService / FPS 监控服务":"Available since v1.2.0 / v1.2.0 起可用\nSingleton service for FPS monitoring, extends ChangeNotifier.FPS 监控单例服务,继承 ChangeNotifier。\nFpsService.instance.start();\nFpsService.instance.stop();\nFpsService.instance.clear();\nfinal fps = FpsService.instance.currentFps;\nfinal jankRate = FpsService.instance.jankRate;\nMethod\tDescription\tstart()\tStart FPS monitoring / 开始 FPS 监控\tstop()\tStop FPS monitoring / 停止 FPS 监控\tclear()\tClear all historical data and counters / 清空所有历史数据和计数器\t\nProperty\tType\tDescription\tisRunning\tbool\tWhether monitoring is currently active / 是否正在监控\tcurrentFps\tdouble\tCurrent FPS (updated every 500ms) / 当前 FPS(每 500ms 更新)\tjankRate\tdouble\tJank rate as percentage / 卡顿率(百分比)\ttotalFrameCount\tint\tTotal frames captured / 总帧数\ttotalJankyCount\tint\tTotal janky frames (>16ms) / 总卡顿帧数(>16ms)\tlastFrameJanky\tbool\tWhether the most recent frame was janky / 最近一帧是否卡顿\tfpsHistory\tList\tRecent 60 FPS values (unmodifiable) / 最近 60 个 FPS 值(不可变)\tframeRecords\tList\tRecent frame records (unmodifiable, up to 3600) / 最近帧记录(不可变,最多 3600 条)\t\nSee FPS Viewer for full feature details.完整功能详情见 FPS Viewer。"}},"/Custom-Database-Provider":{"title":"Custom Database Provider / 自定义数据库提供者","data":{"overview--概述#Overview / 概述":"Zero Inspector Kit supports extending database inspection beyond SQLite through the DatabaseProvider interface.Zero Inspector Kit 通过 DatabaseProvider 接口支持扩展数据库检查功能到 SQLite 以外的数据库。","databaseprovider-interface--接口定义#DatabaseProvider Interface / 接口定义":"abstract class DatabaseProvider {\n /// Provider name / 提供者名称\n String get name;\n /// Get list of databases / 获取数据库列表\n Future> getDatabases();\n /// Query table data / 查询表数据\n Future queryTable(String dbPath, String tableName, {int limit = 50});\n}","data-models--数据模型#Data Models / 数据模型":"","databaseinfo#DatabaseInfo":"Field\tType\tDescription\tname\tString\tDatabase name / 数据库名称\tpath\tString\tDatabase file path / 数据库文件路径\ttables\tList\tList of tables / 表列表","tableinfo#TableInfo":"Field\tType\tDescription\tname\tString\tTable name / 表名\trowCount\tint\tRow count / 行数","queryresult#QueryResult":"Field\tType\tDescription\tcolumns\tList\tColumn names / 列名\trows\tList>\tRow data / 行数据","example-custom-provider--示例自定义提供者#Example: Custom Provider / 示例:自定义提供者":"class MyCustomDatabaseProvider implements DatabaseProvider {\n @override\n String get name => 'CustomDB';\n @override\n Future> getDatabases() async {\n // Return your custom databases / 返回你的自定义数据库列表\n return [\n DatabaseInfo(\n name: 'my_database',\n path: '/path/to/my_database',\n tables: [\n TableInfo(name: 'users', rowCount: 100),\n TableInfo(name: 'orders', rowCount: 500),\n ],\n ),\n ];\n }\n @override\n Future queryTable(\n String dbPath,\n String tableName, {\n int limit = 50,\n }) async {\n // Execute query and return results / 执行查询并返回结果\n return QueryResult(\n columns: ['id', 'name', 'value'],\n rows: [\n {'id': 1, 'name': 'item1', 'value': '100'},\n {'id': 2, 'name': 'item2', 'value': '200'},\n ],\n );\n }\n}","register-provider--注册提供者#Register Provider / 注册提供者":"// Register your custom provider / 注册自定义提供者\nDatabaseRegistry.instance.registerProvider(MyCustomDatabaseProvider());","built-in-provider--内置提供者#Built-in Provider / 内置提供者":"The plugin includes SqliteDatabaseProvider which is auto-registered when enableDatabaseScan is true (default).插件内置 SqliteDatabaseProvider,当 enableDatabaseScan 为 true(默认)时自动注册。You can also register it manually:也可以手动注册:\nDatabaseRegistry.instance.registerProvider(SqliteDatabaseProvider());"}},"/Database-Viewer":{"title":"Database Viewer / 数据库查看器","data":{"overview--概述#Overview / 概述":"The Database Viewer inspects SQLite databases in your app with a two-level navigation system.数据库查看器通过双层导航系统检查应用中的 SQLite 数据库。","auto-scan--自动扫描#Auto-Scan / 自动扫描":"The inspector automatically scans the following directories for .db and .sqlite files:检查器自动扫描以下目录中的 .db 和 .sqlite 文件:\ngetApplicationDocumentsDirectory() / 应用文档目录\ngetDatabasesPath() / 数据库目录","two-level-navigation--双层导航#Two-Level Navigation / 双层导航":"","level-1-database-list-global--第一层数据库列表全局#Level 1: Database List (Global) / 第一层:数据库列表(全局)":"Shows all discovered databases / 显示所有发现的数据库\nEach database shows name and table count / 每个数据库显示名称和表数量\nGlobal search: Search database names and table names / 全局搜索:搜索数据库名和表名","level-2-database-detail--第二层数据库详情#Level 2: Database Detail / 第二层:数据库详情":"Click a database to enter its detail view / 点击数据库进入详情视图\nLeft panel: table list with row counts / 左侧面板:表列表(含行数)\nRight panel: table data in DataTable format / 右侧面板:DataTable 格式的表数据\nBack button to return to database list / 返回按钮返回数据库列表\nIn-database search: Search table names AND all column data / 数据库内搜索:搜索表名和所有列数据","search--搜索#Search / 搜索":"Level\tSearch Scope\tGlobal (database list)\tDatabase names, table names / 数据库名、表名\tIn-database\tTable names, all column values in all tables / 表名、所有表的所有列值","search-highlights--搜索高亮#Search Highlights / 搜索高亮":"When searching within a database, matching cell values are highlighted in accent color.在数据库内搜索时,匹配的单元格值以强调色高亮显示。","ui-features--ui-功能#UI Features / UI 功能":"Color-coded table icons / 带颜色的表图标\nRow count badges for each table / 每个表的行数徽章\nSelected table highlighted / 选中表高亮\nHorizontal and vertical scrollable data table / 水平和垂直可滚动的数据表\nRow count display (filtered / total) when searching / 搜索时显示行数(过滤/总数)","custom-database-provider--自定义数据库提供者#Custom Database Provider / 自定义数据库提供者":"For non-SQLite databases, see Custom Database Provider.对于非 SQLite 数据库,请参阅 自定义数据库提供者。"}},"/FAQ":{"title":"FAQ / 常见问题","data":{"general--通用#General / 通用":"","q-does-the-inspector-affect-production-builds--检查器会影响生产构建吗#Q: Does the inspector affect production builds? / 检查器会影响生产构建吗?":"A: No. The inspector is automatically disabled in release mode via kReleaseMode. Flutter's tree-shaking removes all inspector-related code from production builds. You don't need to remove any code.不会。 检查器在 release 模式下通过 kReleaseMode 自动禁用。Flutter 的 tree-shaking 会移除所有检查器相关代码,无需手动移除。","q-what-platforms-are-supported--支持哪些平台#Q: What platforms are supported? / 支持哪些平台?":"A: Android and iOS.支持 Android 和 iOS。","q-what-flutterdart-versions-are-required--需要什么-flutterdart-版本#Q: What Flutter/Dart versions are required? / 需要什么 Flutter/Dart 版本?":"A: Flutter >= 3.3.0, Dart SDK >= 3.11.0 < 4.0.0.Flutter >= 3.3.0,Dart SDK >= 3.11.0 < 4.0.0。","network--网络#Network / 网络":"","q-do-i-need-to-manually-add-interceptors-for-dio--需要为-dio-手动添加拦截器吗#Q: Do I need to manually add interceptors for Dio? / 需要为 Dio 手动添加拦截器吗?":"A: No. Dio uses IOHttpClientAdapter internally, which uses dart:io's HttpClient. The inspector captures all requests via HttpOverrides automatically, making it truly zero-invasion for both http package and Dio.不需要。 Dio 内部使用 IOHttpClientAdapter,底层使用 dart:io 的 HttpClient。检查器通过 HttpOverrides 自动捕获所有请求,对 http 包和 Dio 都是真正的零侵入。","q-why-do-i-see-duplicate-dio-requests--为什么看到重复的-dio-请求#Q: Why do I see duplicate Dio requests? / 为什么看到重复的 Dio 请求?":"A: If you use both InspectorDioInterceptor and the auto-capture (HttpOverrides), Dio requests will be recorded twice. Simply remove the manual InspectorDioInterceptor — auto-capture handles everything.如果同时使用了 InspectorDioInterceptor 和自动捕获(HttpOverrides),Dio 请求会被记录两次。移除手动 InspectorDioInterceptor 即可,自动捕获会处理一切。","q-can-i-modify-requests-during-testing--测试时可以修改请求吗#Q: Can I modify requests during testing? / 测试时可以修改请求吗?":"A: Yes (since v1.0.7). The inspector supports intercepting and modifying requests via rules. Open a request detail and tap the Interceptor icon to configure a rule. You can modify the request body and request headers only — response fields (status code, response body) are read-only (since v1.0.8). GET requests cannot be modified (no request body). The master toggle is on the Network list page; rules only apply when modification mode is enabled.可以(v1.0.7 起)。检查器支持通过规则拦截并修改请求。打开请求详情,点击拦截器图标配置规则。仅可修改请求体和请求头——响应字段(状态码、响应体)只读(v1.0.8 起)。GET 请求不可修改(无请求体)。总开关在 Network 列表页,规则仅在启用修改模式时生效。See Network Inspector > Request Interceptor for details.详见 Network Inspector > 请求拦截修改。","logging--日志#Logging / 日志":"","q-can-i-use-my-existing-logging-library--可以使用现有的日志库吗#Q: Can I use my existing logging library? / 可以使用现有的日志库吗?":"A: Yes! The inspector automatically captures logs from any library that uses print() or debugPrint(). No configuration needed. Third-party logs are categorized as Info level.可以! 检查器会自动捕获任何使用 print() 或 debugPrint() 的日志库的日志,无需配置。第三方日志统一归类为 Info 级别。","q-how-to-sync-inspector-logs-to-my-logger--如何将检查器日志同步到我的日志库#Q: How to sync inspector logs to my logger? / 如何将检查器日志同步到我的日志库?":"A: Use the onLogCaptured callback:使用 onLogCaptured 回调:\nInspectorLogInterceptor.instance.onLogCaptured = (entry) {\n yourLogger.log(entry.message);\n};\nWarning: Do NOT call print() or logging methods inside this callback, as it will cause infinite recursion.\n警告:不要在此回调中调用 print() 或日志方法,否则会导致无限递归。","database--数据库#Database / 数据库":"","q-why-dont-i-see-any-databases--为什么看不到数据库#Q: Why don't I see any databases? / 为什么看不到数据库?":"A: The inspector scans getApplicationDocumentsDirectory() and getDatabasesPath() for .db and .sqlite files. If your database is stored elsewhere, you can implement a custom DatabaseProvider.检查器扫描 getApplicationDocumentsDirectory() 和 getDatabasesPath() 目录中的 .db 和 .sqlite 文件。如果你的数据库存储在其他位置,可以实现自定义 DatabaseProvider。","memory--内存#Memory / 内存":"","q-why-does-dart-heap-show-na-when-debugging-via-pc--通过-pc-调试时为什么-dart-heap-显示-na#Q: Why does Dart Heap show \"N/A\" when debugging via PC? / 通过 PC 调试时为什么 Dart Heap 显示 \"N/A\"?":"A: This is an expected behavior. When using flutter run to debug via PC, the flutter tool sets up port forwarding between PC and device via adb reverse, allowing PC-side DevTools to access the device's VM Service. However, Service.getInfo() returns a serverUri from the PC's perspective; when the app process internally accesses 127.0.0.1:PC_port, the device doesn't have that port listening locally, resulting in Connection refused and VM Service showing OFF.这是预期行为。 使用 flutter run 连接 PC 调试时,flutter tool 会通过 adb reverse 在 PC 和设备之间做端口转发,让 PC 上的 DevTools 能访问设备的 VM Service。但应用进程内部 Service.getInfo() 返回的 serverUri 是 PC 视角的端口,应用进程访问 127.0.0.1:PC端口 时设备本地并没有监听该端口,导致 Connection refused,VM Service 显示 OFF。Workarounds / 解决方案:\nOpen the debug app directly without PC connection — VM Service works normally / 直接打开 debug 应用(不连 PC),VM Service 正常工作\nUse Native memory data (Android PSS / iOS physicalFootprint) as fallback — always available / 使用 Native 内存数据(Android PSS / iOS physicalFootprint)作为降级,始终可用\nProcess RSS is always available regardless of VM Service / 进程 RSS 无论 VM Service 状态都可用\nSee Memory Viewer > VM Service Availability for details.详见 Memory Viewer > VM Service 可用性。","q-does-memory-monitoring-affect-performance--内存监控会影响性能吗#Q: Does memory monitoring affect performance? / 内存监控会影响性能吗?":"A: Memory monitoring is off by default (since v1.1.0). When disabled, all timers are stopped and VM Service connection is cleared, leaving zero overhead. When enabled, refresh intervals are optimized:内存监控默认关闭(v1.1.0 起)。关闭时所有定时器停止、VM Service 连接清空,零开销。开启时刷新间隔已优化:\nProcess RSS / Dart Heap: 500ms\nNative Memory: 3000ms\nStorage Stats: 3000ms\nLeak Detection: 2000ms\nYou can toggle the switch at the top of the Memory panel anytime.可随时在 Memory 面板顶部切换开关。","q-does-leak-detection-require-code-modification--泄漏检测需要侵入代码吗#Q: Does leak detection require code modification? / 泄漏检测需要侵入代码吗?":"A: The current implementation uses WeakReference + Finalizer, which requires calling trackObject() to register objects for tracking. This is a mild invasion (one line of code per tracked object).当前实现使用 WeakReference + Finalizer,需要调用 trackObject() 注册要追踪的对象。这是轻度侵入(每个追踪对象一行代码)。Trade-offs / 取舍:\nPros: 100% reliable, doesn't depend on VM Service, works in release mode / 100% 可靠,不依赖 VM Service,release 模式也可用\nCons: Requires user to know which objects to track / 需要用户知道要追踪哪些对象\nA zero-invasion Heap Snapshot comparison feature (based on VM Service) is technically possible but would strongly depend on VM Service availability (unavailable when debugging via PC), with significant performance overhead. Not currently implemented.零侵入的 Heap Snapshot 对比功能(基于 VM Service)技术上可行,但会强依赖 VM Service 可用性(PC 调试时不可用),且有显著性能开销。目前未实现。See Memory Viewer > Memory Leak Detection for API details.详见 Memory Viewer > 内存泄漏检测 了解 API 详情。","fps--帧率#FPS / 帧率":"","q-why-does-fps-show-a-very-low-value-eg-9-10-fps--为什么-fps-显示很低如-9-10#Q: Why does FPS show a very low value (e.g. 9-10 FPS)? / 为什么 FPS 显示很低(如 9-10)?":"A: This was a bug fixed in v1.2.0. The root cause was that _recentFrameTimestamps.add(now) was placed outside the for-loop in _onFrameTimings; since Flutter engine's addTimingsCallback is batched (may return multiple frames per call), only one timestamp was recorded per batch, undercounting FPS by 6-10x. Upgrade to ^1.2.0 to fix this.这是 v1.2.0 已修复的 bug。根因是 _onFrameTimings 中 _recentFrameTimestamps.add(now) 在 for 循环外;Flutter 引擎的 addTimingsCallback 是批量回调(一次可能返回多帧),但每批只记录 1 个时间戳,导致 FPS 计算偏低 6-10 倍。升级到 ^1.2.0 即可修复。See FPS Viewer for details.详见 FPS Viewer。","q-does-fps-monitoring-affect-performance--fps-监控会影响性能吗#Q: Does FPS monitoring affect performance? / FPS 监控会影响性能吗?":"A: FPS monitoring is off by default (since v1.2.0). When disabled, no frame timings callbacks and no timers — zero overhead. When enabled, it only processes lightweight frame timing data with bounded history (60 trend points, up to 3600 frame records). You can toggle the switch at the top of the FPS panel anytime.FPS 监控默认关闭(v1.2.0 起)。关闭时无帧回调、无定时器——零开销。开启时仅处理轻量帧时序数据,历史有界(趋势 60 个点,帧记录最多 3600 条)。可随时在 FPS 面板顶部切换开关。","ui--界面#UI / 界面":"","q-the-inspector-panel-gets-pushed-up-when-keyboard-appears--键盘弹出时检查器面板被顶起来了#Q: The inspector panel gets pushed up when keyboard appears. / 键盘弹出时检查器面板被顶起来了。":"A: This was fixed in v1.0.6. The floating button and panel are rendered via Overlay, which is independent of the page layout and not affected by keyboard.此问题已在 v1.0.6 修复。悬浮按钮和面板通过 Overlay 渲染,独立于页面布局,不受键盘影响。","q-how-to-use-search--如何使用搜索#Q: How to use search? / 如何使用搜索?":"A: Each viewer has its own search bar at the top. Database viewer has two-level search: global search (database list) and in-database search (table names + all column data).每个查看器顶部都有搜索栏。数据库查看器有双层搜索:全局搜索(数据库列表)和数据库内搜索(表名 + 所有列数据)。","q-the-floating-button-disappeared--cant-be-opened-after-enabling-fps--开启-fps-后悬浮按钮消失无法打开#Q: The floating button disappeared / can't be opened after enabling FPS. / 开启 FPS 后悬浮按钮消失/无法打开。":"A: This was a bug fixed in v1.2.0. The root cause was that FpsService.notifyListeners() triggered Overlay rebuild; combined with the original Overlay lookup failure (using Overlay.of(context, rootOverlay: true) which returned null), the button State was destroyed and could not recover. Upgrade to ^1.2.0 which uses navigatorState.overlay instead.这是 v1.2.0 已修复的 bug。根因是 FpsService.notifyListeners() 触发 Overlay 重建,叠加原 Overlay 查找失败(使用 Overlay.of(context, rootOverlay: true) 返回 null),导致按钮 State 被销毁且无法恢复。升级到 ^1.2.0,改用 navigatorState.overlay 即可。","q-how-does-the-floating-button-edge-docking-work--悬浮按钮的边缘吸附怎么用#Q: How does the floating button edge docking work? / 悬浮按钮的边缘吸附怎么用?":"A: Since v1.2.0, when you drag the button near a screen edge and release, it auto-docks and tucks into the edge, leaving only a 24px peek visible. The icon becomes a directional chevron hinting you can tap to pull it out:\nTap the peek → smoothly pulls out to fully visible (panel NOT opened, avoids accidental open) / 平滑拉出到完全可见(不打开面板,避免误触)\nTap when fully visible → opens the inspector panel / 打开检查器面板\nThis design avoids conflicts with system back gestures (Android/iOS edge swipe to go back) when pulling out from the docked state.v1.2.0 起,拖动按钮靠近屏幕边缘松手即自动吸附并\"收入\"边缘,仅露 24px。图标变为方向箭头,提示可点击拉出:\n点击露出部分 → 平滑拉出到完全可见(不打开面板,避免误触)\n完全可见时点击 → 打开检查器面板\n此设计避免了从吸附态拖出时与系统返回手势(Android/iOS 边缘右滑退出)的冲突。See Usage > Edge Docking for details.详见 Usage > 边缘吸附。","license--许可证#License / 许可证":"","q-can-i-use-this-in-a-commercial-project--可以在商业项目中使用吗#Q: Can I use this in a commercial project? / 可以在商业项目中使用吗?":"A: Yes. This project is licensed under MPL-2.0. You can use it in closed-source commercial apps — if you use it unmodified, no source disclosure is required. If you modify the plugin's source files, those modified files must be published in source form under MPL-2.0 (your own app still does not need to be open-sourced).可以。本项目采用 MPL-2.0 许可证,可用于闭源商业 App——未修改直接使用时无需公开任何源码;若修改了插件源文件,被修改的文件必须以 MPL-2.0 公开源码(你自己的 App 仍无需开源)。","q-are-you-liable-for-issues-in-modified-versions--修改版出问题你们负责吗#Q: Are you liable for issues in modified versions? / 修改版出问题你们负责吗?":"A: This plugin is provided \"as is\", without warranty of any kind. The author assumes no responsibility or liability for the functionality, security, or any consequences arising from the use of modified versions or derivative projects.本插件按\"原样\"提供,不提供任何担保。作者不对修改版或衍生项目的功能、安全性及任何使用后果承担责任。"}},"/Errors":{"title":"Errors / 异常聚合查看器","data":{"overview--概述#Overview / 概述":"Available since v1.9.0v1.9.0 起可用\nThe Errors tab surfaces \"the same crash happening repeatedly\". When the inspector is running, ErrorService hooks both FlutterError.onError and PlatformDispatcher.onError (keeping the default red-screen / console behavior for both) and aggregates every exception by type + stack signature. Repeated instances of the same crash merge into one record that shows how many times it occurred and when it was first/last seen — instead of flooding the log with hundreds of identical stack traces.Errors 标签页用来快速发现\"同一处崩溃反复出现\"的问题。检查器运行时,ErrorService 会接管 FlutterError.onError(保留默认的红色报错与控制台行为),把每次异常按类型 + 堆栈签名去重聚合:同一处崩溃的多次发生会合并为一条记录,展示累计次数与首末次时间——而不是用成百上千条相同的堆栈刷屏日志。","what-gets-captured--捕获来源#What Gets Captured / 捕获来源":"Source / 来源\tHow / 方式\tFlutter framework errors / Flutter 框架异常\tHooks FlutterError.onError (default handler kept) / 接管 FlutterError.onError(保留默认处理)\tFramework-boundary & platform-channel errors / 框架边界外与平台通道异常\tPlatformDispatcher.onError (with save/restore) / PlatformDispatcher.onError(接管 + 还原)\tUncaught async errors / 未捕获异步异常\trunZonedGuarded inside runAppWithInspector() / runAppWithInspector() 内部的 runZonedGuarded\tManual reports / 手动上报\tErrorService.instance.report(exception, stackTrace) — for gRPC / custom protocols / your own error paths / 用于 gRPC / 自定义协议或你自己的错误通道\t\nCaptured records are also persisted to disk (see Session Persistence below), so aggregated errors from previous sessions are replayed on the next launch.捕获到的记录也会落盘持久化(见下文会话持久化),下次启动时会回放上次会话的聚合异常。","deduplication--去重规则#Deduplication / 去重规则":"Records are keyed by exception type plus a stack signature (first frames with line/address noise stripped) / 按异常类型 + 堆栈签名(取前若干帧并去掉行号/地址噪声)去重\nA new occurrence of an existing signature bumps its count and updates lastSeen instead of adding a new row / 同签名的再次发生只累加 count 并更新 lastSeen,不新增行\nRing buffer capped at 200 aggregated records (oldest dropped) / 环形缓冲上限 200 条聚合记录(超出丢弃最旧)","ui-features--ui-功能#UI Features / UI 功能":"","errors-tab--errors-标签页#Errors Tab / Errors 标签页":"Lists aggregated errors newest-first, showing the exception type, message, first seen / last seen time, and a ×N badge when the same crash recurred / 按最新在前列出聚合异常,展示异常类型、消息、首次/末次出现时间,同崩溃复发时显示 ×N 徽章\nTap a row to expand the full stack sample (truncated at 8000 chars); tap again to collapse / 点击行展开完整堆栈样本(8000 字符截断);再点收起\nCopy stack per row / 行内复制堆栈\nSearch filters by exception type or message / 搜索按异常类型或消息过滤\nClear empties the aggregated list / 清除清空聚合列表","tab-badge--标签页红点#Tab Badge / 标签页红点":"The Errors tab icon shows a red count badge while there are aggregated errors (capped at 99+), so recurring crashes are visible at a glance / Errors 标签页图标在有聚合异常时显示红色计数(99+ 封顶),一眼可见反复崩溃\nOpening the Errors tab is not required to see the badge — it reflects ErrorService.instance.errorCount whenever the panel is open / 只要面板打开,标签红点即反映 ErrorService.instance.errorCount,无需先进入 Errors 页\nNote: the floating ball itself stays clean — its red count (if any) is the Alerts unread badge (AlertService), not error aggregation.注意:悬浮球本身保持纯粹——球上的红色数字(如有)来自告警未读数(AlertService),与异常聚合无关。","api--接口#API / 接口":"The full service is re-exported from the package root — no need to import lib/src/.完整服务已从包根导出,无需 import lib/src/。\nimport 'package:zero_inspector_kit/zero_inspector_kit.dart';\n// Report an exception manually (gRPC/custom protocol/your own error paths) / 手动上报异常\nErrorService.instance.report(error, stackTrace, 'myModule');\n// Read the aggregated view (newest first) / 读取聚合视图(最新在前)\nfinal ErrorRecord latest = ErrorService.instance.errors.first;\nprint('${latest.type} x${latest.count} — first ${latest.firstSeen} / last ${latest.lastSeen}');\n// Clear all records / 清空所有记录\nErrorService.instance.clear();\nMember\tDescription\terrors\tList — aggregated records, newest first / 聚合记录,最新在前\terrorCount\tint — number of aggregated records / 聚合记录条数\tisEnabled\tbool — capture toggle (programmatic) / 抓取开关(代码控制)\treport(exception, stack, [context])\tManually report an exception / 手动上报异常\trestore(records)\tRestore persisted records (replay on launch; existing dedup ids are skipped) / 恢复持久化记录(启动回放;已存在的去重 id 跳过)\tclear()\tClear all aggregated records / 清空全部记录\tinstall() / uninstall()\tHook / restore FlutterError.onError and PlatformDispatcher.onError / 接管 / 还原 FlutterError.onError 与 PlatformDispatcher.onError","errorrecord--异常记录#ErrorRecord / 异常记录":"Field\tDescription\ttype\tException type name (e.g. _TypeError) / 异常类型名\tmessage\tException message / 异常消息\tcount\tTotal occurrences / 累计出现次数\tfirstSeen / lastSeen\tFirst / last occurrence time / 首次 / 末次出现时间\tsampleStack\tOne full stack sample (may be truncated) / 一条完整堆栈样本(可能截断)","session-persistence--会话持久化#Session Persistence / 会话持久化":"Errors — together with logs, network requests and alerts — are asynchronously flushed to a local SQLite ring buffer (zero_inspector_kit.db). On the next launch, logs, aggregated errors and alerts replay into their tabs, so a crash you saw yesterday is still inspectable today even though the panel was never opened; network requests stay archived on disk for later export. Use the storage icon in the panel header to open the Persisted data manager: see the current row counts, export the full session archive as JSON, or clear the disk. See Configuration (PersistenceService section) for details and the tuning parameters.异常与日志、网络请求、告警一起被异步写入本地 SQLite 环形缓冲(zero_inspector_kit.db)。下次启动时,日志、聚合异常与告警会回放入各自标签页——即使昨天从没打开过面板,今天依然能复盘当时的崩溃现场;网络请求保留在磁盘存档,供之后导出。点击面板头部的存储图标可打开 Persisted data 管理弹层:查看当前行数、导出完整会话存档 JSON,或清空磁盘。详见 Configuration(PersistenceService 一节)的参数说明。","enable--disable--开关#Enable / Disable / 开关":"enableErrorCapture (default true) in ZeroInspectorKit.init() controls error aggregation / init() 的 enableErrorCapture(默认 true)控制异常聚合\nenablePersistence (default true) controls the disk ring buffer / enablePersistence(默认 true)控制磁盘环形缓冲\nSet both to false to keep everything in memory only / 两者都设为 false 时数据仅保留在内存\nZeroInspectorKit.init(\n enableErrorCapture: true,\n enablePersistence: true, // false → memory-only / 关闭后仅内存\n);","related--相关#Related / 相关":"Log Viewer — raw log stream including error lines / 原始日志流(含错误行)\nConfiguration — init parameters and full service APIs / 初始化参数与完整服务接口\nUsage — general usage guide / 使用指南"}},"/FPS-Viewer":{"title":"FPS Viewer / FPS 监控面板","data":{"":"The FPS Viewer provides real-time frame performance analysis, including current FPS, jank rate, frame duration stats, and an FPS trend chart.FPS 监控面板提供实时帧性能分析,包括当前 FPS、卡顿率、帧耗时统计和 FPS 趋势图。\nAvailable since v1.2.0v1.2.0 起可用","overview--概览#Overview / 概览":"The FPS Viewer is integrated into the inspector panel. Tap the floating inspector button → \"FPS\" tab to access.FPS 监控面板集成在检查器面板中。点击悬浮检查器按钮 → \"FPS\" 标签即可访问。⚠️ Important: FPS monitoring is off by default. You must toggle on the switch at the top of the panel to start collecting data.⚠️ 重要:FPS 监控默认关闭。必须在面板顶部打开开关才会开始采集数据。","master-switch--总开关#Master Switch / 总开关":"A switch at the top of the FPS panel controls whether monitoring is enabled.FPS 面板顶部有一个开关,控制是否启用监控。\nState\tBehavior\tOFF (default)\tNo frame timings callbacks, no timer, zero overhead / 无帧回调、无定时器、零开销\tON\tStarts collecting frame data via WidgetsBinding.instance.addTimingsCallback / 通过 addTimingsCallback 开始采集帧数据\t\nWhen turned off, all callbacks and timers are cancelled, leaving no residual overhead.关闭时所有回调和定时器会被取消,不会残留开销。","features--功能#Features / 功能":"","1-current-stats--当前统计#1. Current Stats / 当前统计":"Current FPS — Updated every 500ms / 每 500ms 更新\nJank Rate — Percentage of janky frames (duration exceeds the per-frame budget, derived from the display refresh rate) / 卡顿帧占比(帧耗时超过由屏幕刷新率换算的逐帧预算)\nTotal Frame Count — All frames captured since start / 自启动以来的总帧数\nTotal Janky Count — All janky frames captured / 自启动以来的总卡顿帧数\nLast Frame Janky — Whether the most recent frame was janky / 最近一帧是否卡顿\n显示当前 FPS、卡顿率、总帧数、总卡顿帧数、最近一帧是否卡顿。","2-fps-trend-chart--fps-趋势图#2. FPS Trend Chart / FPS 趋势图":"Real-time line chart with 30-second history window (60 data points × 500ms)\nY-axis dynamically scales to max(60, maxFps) to avoid overflow when FPS spikes\nJanky frame region marked in red\nTime axis labels: -30s / -15s / Now\n实时折线图,30 秒历史窗口(60 个数据点 × 500ms)。Y 轴动态缩放为 max(60, maxFps) 避免 FPS 飙升时溢出。卡顿区域以红色标记。","3-janky-frame-list--卡顿帧列表#3. Janky Frame List / 卡顿帧列表":"Lists janky frames — duration exceeds the per-frame budget, derived from the display refresh rate (~16.7ms at 60Hz, ~8.3ms at 120Hz) / 列出卡顿帧——帧耗时超过由屏幕刷新率换算的逐帧预算(60Hz≈16.7ms、120Hz≈8.3ms)\nEach item shows frame duration and timestamp, plus the build / raster split (buildDurationUs + rasterDurationUs) so you can tell whether build or GPU raster is the bottleneck / 每项显示帧耗时、时间戳,以及 build / raster 分项(buildDurationUs + rasterDurationUs),便于判断是构建还是 GPU 光栅化卡顿\nHelps identify specific jank spikes / 帮助定位具体卡顿点\n列出卡顿帧(帧耗时超过由屏幕刷新率换算的逐帧预算,60Hz≈16.7ms、120Hz≈8.3ms),每项显示帧耗时、时间戳与 build / raster 分项,帮助定位具体卡顿点。","4-reset--重置#4. Reset / 重置":"\"Reset\" button clears all statistics and historical data / \"Reset\" 按钮清空所有统计和历史数据\nUseful for measuring a specific interaction scenario / 适合测量特定交互场景\n\"Reset\" 按钮清空所有统计和历史数据,适合测量特定交互场景。","main-thread-blocking-watchdog--主线程阻塞看门狗#Main-thread Blocking Watchdog / 主线程阻塞看门狗":"The FPS panel also includes a main-thread blocking watchdog that catches stalls FPS cannot see.FPS 面板还内置主线程阻塞看门狗,专门捕捉 FPS 看不见的卡死。\nAvailable since v1.12.0v1.12.0 起可用\nWhy it's needed / 为什么需要: FPS only measures frames. When the UI isolate truly stalls (e.g. a synchronous heavy computation), it produces zero frames, so FPS reads as idle while the app is actually frozen. The watchdog closes that blind spot.FPS 只测帧。当 UI isolate 真正卡死(如同步重计算)时,它零帧产出,于是 FPS 显示空闲,而 App 其实已冻住。看门狗补上这个盲区。How it works / 工作原理:\nA low-frequency 100ms heartbeat measures the UI isolate's responsiveness directly / 用 100ms 低频心跳 直接测量 UI isolate 的响应间隔\nIf a gap exceeds 300ms with no response, it records a blocking event (duration / time / nearby logs) / 若超过 300ms 无响应,记录一条阻塞事件(时长 / 时间 / 附近日志)\nOff by default with its own switch (not tied to the FPS master switch) — zero overhead unless you opt in / 默认关闭、有独立开关(不随 FPS 总开关联动),不开启则零开销\n开启后,真正卡死(不产帧)也会被记成阻塞事件,配合 FPS 一起看因果。","how-it-works--工作原理#How It Works / 工作原理":"FPS monitoring uses Flutter's WidgetsBinding.instance.addTimingsCallback to receive frame timing information from the engine. The callback is batched — it may return multiple FrameTiming objects per call, so each frame is recorded individually inside the loop to ensure accurate FPS calculation.FPS 监控使用 Flutter 的 WidgetsBinding.instance.addTimingsCallback 接收引擎的帧时序信息。该回调是批量的——每次调用可能返回多个 FrameTiming 对象,因此在循环内部为每帧单独记录时间戳,确保 FPS 计算准确。Jank threshold / 卡顿阈值: A frame is janky when its total duration (build + raster) exceeds the per-frame budget — 1000ms ÷ refreshRate (≈16.7ms at 60Hz, ≈8.3ms at 120Hz). Since v1.11.0 the budget is derived from the device's refresh rate, so high-refresh (120Hz) screens are held to a tight ≈8.3ms instead of being forgiven by a fixed 16ms.卡顿阈值:帧的总耗时(build + raster)超过逐帧预算即视为卡顿——1000ms ÷ 刷新率(60Hz≈16.7ms、120Hz≈8.3ms)。自 v1.11.0 起预算按设备刷新率换算,高刷(120Hz)屏会被严格约束在 ≈8.3ms,而非被固定 16ms 放过。Phased timing / 分阶段耗时: Each FrameRecord carries buildDurationUs and rasterDurationUs (GPU raster); the janky-frame list shows the build / raster split per row.分阶段耗时:每条 FrameRecord 都带有 buildDurationUs 与 rasterDurationUs(GPU 光栅化),掉帧列表项会展示 build / raster 分项。","programmatic-control-optional--编程式控制可选#Programmatic Control (Optional) / 编程式控制(可选)":"If you need to start/stop monitoring from code (e.g., for automated testing), use FpsService:如需从代码控制监控(如自动化测试),使用 FpsService:\n// Start / Stop FPS monitoring / 开始 / 停止 FPS 监控\nFpsService.instance.start();\nFpsService.instance.stop();\n// Read current stats / 读取当前统计\nfinal fps = FpsService.instance.currentFps;\nfinal jankRate = FpsService.instance.jankRate;\nfinal totalFrames = FpsService.instance.totalFrameCount;\nfinal jankyFrames = FpsService.instance.totalJankyCount;\n// Clear historical data / 清空历史数据\nFpsService.instance.clear();\n// Listen to updates / 监听更新\nFpsService.instance.addListener(() {\n // Update your own UI / 更新你自己的 UI\n});\n// Historical data access / 历史数据访问\nfinal history = FpsService.instance.fpsHistory; // List, 60 entries / 60 条\nfinal records = FpsService.instance.frameRecords; // List, unmodifiable / 不可变,最多 3600 条","fpsservice-api--fpsservice-接口#FpsService API / FpsService 接口":"Singleton service extending ChangeNotifier.继承 ChangeNotifier 的单例服务。\nMethod\tDescription\tstart()\tStart FPS monitoring / 开始 FPS 监控\tstop()\tStop FPS monitoring / 停止 FPS 监控\tclear()\tClear all historical data and counters / 清空所有历史数据和计数器\t\nProperty\tType\tDescription\tisRunning\tbool\tWhether monitoring is currently active / 是否正在监控\tcurrentFps\tdouble\tCurrent FPS (updated every 500ms) / 当前 FPS(每 500ms 更新)\tjankRate\tdouble\tJank rate as percentage / 卡顿率(百分比)\ttotalFrameCount\tint\tTotal frames captured / 总帧数\ttotalJankyCount\tint\tTotal janky frames captured (per-frame budget) / 总卡顿帧数(按逐帧预算)\tlastFrameJanky\tbool\tWhether the most recent frame was janky / 最近一帧是否卡顿\tfpsHistory\tList\tRecent 60 FPS values (unmodifiable) / 最近 60 个 FPS 值(不可变)\tframeRecords\tList\tRecent frame records (unmodifiable, up to 3600) / 最近帧记录(不可变,最多 3600 条)","performance-considerations--性能说明#Performance Considerations / 性能说明":"Off by default / 默认关闭: Zero overhead when disabled / 关闭时零开销\nLightweight callbacks / 轻量回调: Only processes frame timing data, no heavy computation / 仅处理帧时序数据,无重计算\nBounded history / 有界历史: Trend chart keeps only 60 points, frame records capped at 3600 / 趋势图仅保留 60 个点,帧记录上限 3600 条\nSafe with other features / 与其他功能兼容: Can run alongside Memory Viewer monitoring / 可与 Memory Viewer 监控同时运行","platform-support--平台支持#Platform Support / 平台支持":"Feature\tAndroid\tiOS\tFPS Monitoring\t✅\t✅\tJank Detection\t✅\t✅\tTrend Chart\t✅\t✅\t\nFPS monitoring uses Flutter engine APIs and works on Android and iOS (the two platforms this plugin targets).FPS 监控使用 Flutter 引擎 API,在本插件支持的两个平台 Android 与 iOS 上均可用。","demo--演示#Demo / 演示":"The Example App includes an FPS demo module with three scenarios:Example App 包含 FPS 演示模块,提供三种场景:\nDemo\tDescription\tTrigger Jank\tBlocks the main thread for 100-500ms to simulate jank / 阻塞主线程 100-500ms 模拟卡顿\tHeavy Animations\t80 simultaneously rotating+scaling widgets to intentionally trigger jank / 80 个同时旋转+缩放的 widget 故意触发卡顿\tSmooth Animation\tSingle lightweight compound animation, demonstrates stable 60 FPS / 单个轻量复合动画,演示稳定 60 FPS","related--相关#Related / 相关":"Usage — General usage guide / 通用使用指南\nFAQ — Common questions / 常见问题\nConfiguration — Configuration options / 配置选项"}},"/Installation":{"title":"Installation / 安装","data":{"from-pubdev-recommended--从-pubdev-安装推荐#From pub.dev (Recommended) / 从 pub.dev 安装(推荐)":"Add the following to your pubspec.yaml:在 pubspec.yaml 中添加以下依赖:\ndependencies:\n zero_inspector_kit: ^1.14.0\nThen run:然后运行:\nflutter pub get","from-github--从-github-安装#From GitHub / 从 GitHub 安装":"Alternatively, install from GitHub:或者从 GitHub 安装:\ndependencies:\n zero_inspector_kit:\n git:\n url: https://github.com/zero-labsco/zero_inspector_kit.git\n ref: release/v1.14.0","platform-setup--平台配置#Platform Setup / 平台配置":"","android#Android":"No additional configuration needed.无需额外配置。","ios#iOS":"No additional configuration needed.无需额外配置。","import--导入#Import / 导入":"import 'package:zero_inspector_kit/zero_inspector_kit.dart';","requirements--环境要求#Requirements / 环境要求":"Requirement\tVersion\tFlutter\t>= 3.3.0\tDart SDK\t>= 3.11.0 < 4.0.0","next-steps--下一步#Next Steps / 下一步":"Getting Started — Quick start guide / 快速开始\nUsage — Full usage guide / 完整使用指南"}},"/Getting-Started":{"title":"Getting Started / 快速开始","data":{"quick-start--快速开始#Quick Start / 快速开始":"Integrate with just 1 line of code:仅需 1 行代码 即可完成集成:\nimport 'package:flutter/material.dart';\nimport 'package:zero_inspector_kit/zero_inspector_kit.dart';\nvoid main() {\n // Single line: Initialize inspector, capture print() via Zone, and display floating button\n // 一行代码:初始化检查器、通过 Zone 捕获 print()、自动显示悬浮按钮\n ZeroInspectorKit.runAppWithInspector(const MyApp());\n}\nclass MyApp extends StatelessWidget {\n const MyApp({super.key});\n @override\n Widget build(BuildContext context) {\n return MaterialApp(\n home: Scaffold(\n appBar: AppBar(title: const Text('App')),\n body: const Center(child: Text('Hello World')),\n ),\n );\n }\n}","what-happens-automatically--自动完成的工作#What Happens Automatically / 自动完成的工作":"After integration, the inspector automatically does the following without modifying any other project code:集成后,检查器会自动完成以下工作,无需修改项目其他代码:\nFeature\tDescription\t✅ Log Capture\tAuto-capture all print(), debugPrint() via Zone / 通过 Zone 自动捕获所有日志\t✅ Network Interception\tAuto-intercept all http and Dio requests via HttpOverrides / 自动拦截所有网络请求\t✅ Error Capture\tAggregate Flutter framework errors & unhandled exceptions, deduped by type + stack (Errors tab) / 聚合 Flutter 框架异常与未捕获异常,按类型+堆栈去重\t✅ Session Persistence\tFlush logs/network/errors to a disk ring buffer; logs & errors replay on next launch / 日志/网络/异常落盘环形缓冲,启动时回放日志与异常\t✅ Database Scan\tAuto-scan and register SQLite databases / 自动扫描注册数据库\t✅ Floating Button\tAuto-displayed via Overlay, not affected by keyboard / 通过 Overlay 自动显示\t✅ Route Tracking\tAuto-inject InspectorRouteObserver into MaterialApp / 自动注入路由观察者\t\nNote / 说明: The Memory and FPS panels are available as tabs but are off by default to avoid performance overhead. Toggle the switch at the top of each panel to start collecting data. See Memory Viewer and FPS Viewer for details.Memory 和 FPS 面板作为标签页可用,但默认关闭以避免性能开销。在各自面板顶部打开开关才会开始采集数据。详见 Memory Viewer 和 FPS Viewer。\nPre-initialized binding / 提前初始化的 binding: If you call WidgetsFlutterBinding.ensureInitialized() or await a platform-channel plugin (e.g. SharedPreferences) before runAppWithInspector(), the binding is already initialized. In that case runAppWithInspector() degrades gracefully to a plain runApp() (capturing debugPrint logs, but not raw print()) instead of throwing a \"Zone mismatch\" assertion. No extra setup is needed.binding 已提前初始化:如果你在 runAppWithInspector() 之前调用了 WidgetsFlutterBinding.ensureInitialized() 或 await 了会触发 platform channel 的插件(如 SharedPreferences),binding 已被初始化。此时 runAppWithInspector() 会优雅降级为普通 runApp()(仍捕获 debugPrint 日志,但不捕获原始 print()),而非抛出 \"Zone mismatch\" 断言。无需额外处理。","production-build--生产构建#Production Build / 生产构建":"The inspector is automatically disabled in release mode. You don't need to remove any code — Flutter's tree-shaking will remove all inspector-related code from production builds.检查器在 release 模式下会自动禁用,无需移除任何代码,Flutter 的 tree-shaking 会自动移除所有检查器相关代码。","alternative-integration--替代集成方式#Alternative Integration / 替代集成方式":"If you prefer more control, use the two-line approach:如果需要更多控制权,可以使用两行代码方式:\nvoid main() {\n ZeroInspectorKit.init();\n runApp(ZeroInspectorKit.wrapApp(const MyApp()));\n}","next-steps--下一步#Next Steps / 下一步":"Installation — Detailed installation methods / 详细安装方式\nUsage — Full usage guide / 完整使用指南\nConfiguration — Configuration options / 配置选项"}},"/Log-Viewer":{"title":"Log Viewer / 日志查看器","data":{"overview--概述#Overview / 概述":"The Log Viewer automatically captures logs from multiple sources with zero configuration.日志查看器自动从多个来源捕获日志,无需配置。","log-sources--日志来源#Log Sources / 日志来源":"Source\tCapture Method\tprint()\tZone specification override / Zone 规范覆盖\tdebugPrint()\tdebugPrint override / debugPrint 覆盖\tFlutter errors\tFlutterError.onError hook / 接管 FlutterError.onError\tUnhandled exceptions\trunZonedGuarded / runZonedGuarded 捕获\tThird-party libraries\tVia print() capture / 通过 print() 捕获\t\nSince v1.9.0, Flutter framework errors and unhandled exceptions are also aggregated & deduplicated in the dedicated Errors tab (keyed by type + stack signature) — while this Log Viewer keeps showing them as error-level lines in the chronological stream. Use Errors for \"is this crash repeating?\"; use Log Viewer for the raw timeline.自 v1.9.0 起,Flutter 框架异常与未捕获异常会同时进入独立的 Errors 标签页去重聚合(按类型 + 堆栈签名归并);本 Log Viewer 仍会在原始时间流中把它们显示为错误级日志。回答\"该崩溃是否反复出现\"请用 Errors;查看原始时间线请用 Log Viewer。","log-levels--日志级别#Log Levels / 日志级别":"Level\tAbbreviation\tColor\tDescription\tVerbose\tV\tGray\tDetailed information / 详细信息\tDebug\tD\tBlue\tDebug information / 调试信息\tInfo\tI\tGreen\tGeneral information / 一般信息\tWarning\tW\tOrange\tWarning messages / 警告信息\tError\tE\tRed\tError messages / 错误信息\t\nThird-party library logs are categorized as Info level.\n第三方日志库的日志统一归类为 Info 级别。","ui-features--ui-功能#UI Features / UI 功能":"","filter-bar--过滤栏#Filter Bar / 过滤栏":"All: Show all logs / 使用 All 显示所有日志\nV / D / I / W / E: Filter by level / 按级别过滤\nTag dropdown: Filter by any captured tag / 按任意已捕获标签过滤\nSingle-select mode / 单选模式","toolbar--工具栏#Toolbar / 工具栏":"Auto-scroll toggle (default on): Jump to the newest log as new entries arrive; pause to keep history still for inspection / 自动滚动开关(默认开启):新日志到达时自动跳到最新;暂停可稳定查看历史\nCopy as JSON: Copy all currently filtered logs as JSON / 复制为 JSON:将当前过滤后的全部日志复制为 JSON\nShare as Text: Share filtered logs as plain text / 分享为文本:将过滤后的日志以纯文本分享\nClear: Clear all logs / 清除:清空全部日志","log-list--日志列表#Log List / 日志列表":"Level badge with color / 带颜色的级别徽章\nTimestamp display / 时间戳显示\nTag display (if available) / 标签显示(如有)\nError/warning rows have subtle background tint / 错误/警告行有淡色背景\nLeft border color indicates level / 左侧边框颜色表示级别\nTap a row to open the in-view detail page with full message and copy; use the back button to return / 点击行进入详情页(主视图内切换),可查看完整消息并复制,点返回按钮回到列表\nPer-row copy button copies that single log as JSON / 行内复制按钮将该条日志以 JSON 复制","search--搜索#Search / 搜索":"Fuzzy search by message content or tag / 按消息内容或标签模糊搜索\nToggle regex mode (. * button) to search with RegExp (case-insensitive); invalid patterns degrade gracefully instead of crashing / 点击 正则模式(. * 按钮)使用 RegExp 搜索(不区分大小写);非法图案优雅降级,不会崩溃\nCombined with level and tag filters / 可与级别、标签过滤组合使用","manual-logging--手动记录日志#Manual Logging / 手动记录日志":"Quick shorthand (recommended) / 简化写法(推荐) — available since v1.1.2 / v1.1.2 起可用:\nInspectorLog.v('Verbose message / 详细消息');\nInspectorLog.d('Debug message / 调试消息');\nInspectorLog.i('Info message / 信息消息');\nInspectorLog.w('Warning message / 警告消息');\nInspectorLog.e('Error message / 错误消息');\n// With tag / 带标签\nInspectorLog.i('User logged in', tag: 'Auth');\nFull form / 完整写法:\nInspectorLogInterceptor.instance.verbose('Verbose message / 详细消息');\nInspectorLogInterceptor.instance.debug('Debug message / 调试消息');\nInspectorLogInterceptor.instance.info('Info message / 信息消息');\nInspectorLogInterceptor.instance.warning('Warning message / 警告消息');\nInspectorLogInterceptor.instance.error('Error message / 错误消息');\n// With tag / 带标签\nInspectorLogInterceptor.instance.info('User logged in', tag: 'Auth');\nInspectorLog is a static wrapper around InspectorLogInterceptor.instance for shorter log calls.InspectorLog 是 InspectorLogInterceptor.instance 的静态包装,用于更简短的日志调用。","third-party-library-integration--第三方日志库集成#Third-Party Library Integration / 第三方日志库集成":"","auto-capture-inbound--自动捕获入站#Auto-Capture (Inbound) / 自动捕获(入站)":"No configuration needed. Any library using print() or debugPrint() is automatically captured.无需配置。任何使用 print() 或 debugPrint() 的库都会被自动捕获。","bidirectional-sync-optional--双向同步可选#Bidirectional Sync (Optional) / 双向同步(可选)":"To forward inspector logs to your third-party logger:将检查器日志转发到第三方日志库:\nimport 'package:logger/logger.dart';\nfinal logger = Logger();\nInspectorLogInterceptor.instance.onLogCaptured = (entry) {\n logger.log(\n _mapLogLevel(entry.level),\n '${entry.tag != null ? '[${entry.tag}] ' : ''}${entry.message}',\n );\n};\nNote: Do NOT call logging methods inside onLogCaptured, as this will cause infinite recursion.\n注意:不要在 onLogCaptured 内部调用日志方法,否则会导致无限递归。","starting-the-log-interceptor--启动日志拦截器#Starting the Log Interceptor / 启动日志拦截器":"If using runAppWithInspector(), the log interceptor starts automatically. Otherwise:如果使用 runAppWithInspector(),日志拦截器会自动启动。否则:\nInspectorLogInterceptor.instance.start();"}},"/Memory-Viewer":{"title":"Memory Viewer / 内存监控面板","data":{"":"The Memory Viewer provides comprehensive in-app memory analysis, including trend charts, Dart Heap details, Native memory breakdown, memory leak detection, image cache monitoring, and storage statistics.内存监控面板提供应用内全面内存分析,包括趋势图、Dart Heap 详情、Native 内存分项、内存泄漏检测、图片缓存监控和存储统计。\nAvailable since v1.1.0v1.1.1 起可用","overview--概览#Overview / 概览":"The Memory Viewer is integrated into the inspector panel. Tap the floating inspector button → \"Memory\" tab to access.内存监控面板集成在检查器面板中。点击悬浮检查器按钮 → \"Memory\" 标签即可访问。⚠️ Important: Memory monitoring is off by default. You must toggle on the switch at the top of the panel to start collecting data.⚠️ 重要:内存监控默认关闭。必须在面板顶部打开开关才会开始采集数据。","master-switch--总开关#Master Switch / 总开关":"A switch at the top of the Memory panel controls whether monitoring is enabled.Memory 面板顶部有一个开关,控制是否启用监控。\nState\tBehavior\tOFF (default)\tNo timers, no VM Service connection, zero overhead / 无定时器、无 VM Service 连接、零开销\tON\tStarts RSS collection (500ms), Native memory (3s), storage stats (3s), leak detection (2s), and VM Service connection attempt / 启动 RSS 采集(500ms)、Native 内存(3s)、存储统计(3s)、泄漏检测(2s),并尝试连接 VM Service\t\nWhen turned off, all timers are cancelled and the VM Service connection state is cleared, leaving no residual WebSocket overhead.关闭时所有定时器会被取消,VM Service 连接状态会被清空,不会残留 WebSocket 开销。","features--功能#Features / 功能":"","1-memory-trend-chart--内存趋势图#1. Memory Trend Chart / 内存趋势图":"Real-time line chart with 2-minute history window (240 snapshots × 500ms)\nSwitchable between 4 metrics via the metric selector chips:\nProcess RSS — Process-level RSS (always available)\nDart Heap — Total Dart Heap usage (requires VM Service)\nNew Space — New generation usage (requires VM Service)\nOld Space — Old generation usage (requires VM Service)\n实时折线图,2 分钟历史窗口(240 条快照 × 500ms)。可通过指标选择芯片切换 4 种指标。","2-native-memory--native-内存真机-100-可用#2. Native Memory / Native 内存(真机 100% 可用)":"Does not depend on VM Service. Data is collected via Platform Channel:不依赖 VM Service,通过 Platform Channel 采集:Android (Debug.MemoryInfo + /proc/self/status):\nTotal PSS / Dalvik PSS / Native PSS / Native Private Dirty\nProcess RSS (from /proc/self/status)\nDevice memory status (availMem, threshold, lowMemory)\niOS (mach task_info):\nPhysical Footprint (Apple's recommended metric)\nInternal / Compressed / Resident Size\nProcess RSS\nDevice available memory","3-dart-heap-overview--dart-heap-概览需要-vm-service#3. Dart Heap Overview / Dart Heap 概览(需要 VM Service)":"Heap Usage / Capacity / external usage\nProgress bar showing heap usage ratio\nThree core metrics with bilingual labels\n显示 Heap Usage / Capacity / External 三个核心指标 + 进度条。","4-heap-generations--堆分代详情需要-vm-service#4. Heap Generations / 堆分代详情(需要 VM Service)":"New Space: usage / capacity / external\nOld Space: usage / capacity / external\nHelps identify allocation patterns (frequent new-space churn vs old-space growth)\n显示新生代/老生代的 Usage / Capacity / External 详细数据。","5-manual-gc--手动触发-gc需要-vm-service#5. Manual GC / 手动触发 GC(需要 VM Service)":"\"Trigger GC\" button forces a full garbage collection\nDisabled (grayed out) when VM Service is unavailable\n\"Trigger GC\" 按钮强制触发完整垃圾回收。VM Service 不可用时按钮变灰禁用。","6-memory-leak-detection--内存泄漏检测#6. Memory Leak Detection / 内存泄漏检测":"Based on Dart 2.17+ WeakReference and Finalizer. Does NOT depend on VM Service.基于 Dart 2.17+ 的 WeakReference 和 Finalizer,不依赖 VM Service。Four-state transition / 四状态流转:\nState\tMeaning\ttracking\tObject registered, waiting for expected release time / 对象已注册,等待预期释放时间\tverifying\tExceeded expected release time, GC verification triggered (if VM Service available) / 超过预期释放时间,触发 GC 验证(VM Service 可用时)\tleaked\tObject still exists after GC — suspected leak / GC 后对象仍存在——疑似泄漏\treleased\tObject has been garbage collected / 对象已被垃圾回收\t\nAPI / 接口:Quick shorthand (recommended) / 简化写法(推荐) — available since v1.1.2 / v1.1.2 起可用:\n// Extension method on Object / Object 上的扩展方法\nmyBloc.trackMemoryLeak(tag: 'HomePage_myBloc');\n// Or top-level function / 或使用顶层函数\ntrackMemoryLeak(myBloc, tag: 'HomePage_myBloc');\n// Cancel tracking / 取消追踪\nmyBloc.untrackMemoryLeak();\nFull form / 完整写法:\n// Register an object for leak tracking / 注册对象进行泄漏追踪\nMemoryInspectorService.instance.trackObject(\n myController,\n tag: 'HomeController_textController', // optional identifier\n expectedReleaseAfter: const Duration(seconds: 30), // expected release time\n);\n// Stop tracking a specific object / 停止追踪特定对象\nMemoryInspectorService.instance.untrackObject(myController);\n// Clear all records / 清空所有记录\nMemoryInspectorService.instance.clearLeakRecords();\nLimits / 限制:\nMax 500 tracked objects (LRU eviction)\nDetection interval: 2 seconds\ntrackObject() requires user code modification (mild invasion)\nFlutter MemoryAllocations bridge (since v1.9.0) / 官方泄漏追踪桥接(v1.9.0 起)The WeakReference state machine has a blind spot: an object whose dispose() ran but that has not been GC'd yet still resolves through the weak reference, producing a false \"leaked\" verdict. Since v1.9.0, MemoryInspectorService also subscribes to Flutter's official FlutterMemoryAllocations (the data source behind leak_tracker) via LeakTrackerBridge: once the official stream reports disposed, the object is treated as released (awaiting GC) even if the weak reference still resolves — cutting false positives. Enabled by default through enableFlutterLeakTracker in init(), and toggled in code via MemoryInspectorService.instance.flutterLeakTrackerEnabled.WeakReference 状态机有一个盲点:对象已调用 dispose() 但尚未被 GC 时弱引用仍存活,会产生\"疑似泄漏\"的误报。v1.9.0 起,MemoryInspectorService 通过 LeakTrackerBridge 额外订阅 Flutter 官方的 FlutterMemoryAllocations(leak_tracker 背后的数据源):只要官方上报 disposed,即便弱引用仍存活也判定为已释放(等待 GC),从而显著降低误报。由 init() 的 enableFlutterLeakTracker 默认启用,也可用 MemoryInspectorService.instance.flutterLeakTrackerEnabled 在代码中开关。","7-image-cache--图片缓存#7. Image Cache / 图片缓存":"Real-time Flutter image cache size and count\nPending (loading) / Live (in use) image counts\nOne-click clear all image cache\n实时显示 Flutter 图片缓存大小、数量、加载中/使用中状态。一键清理图片缓存。","8-app-storage--应用存储#8. App Storage / 应用存储":"Documents directory size\nTemp cache directory size\nTotal database file size\nOne-click clear temp cache\n显示文档目录、临时缓存、数据库文件大小。一键清理临时缓存。","️-vm-service-availability--vm-service-可用性#⚠️ VM Service Availability / VM Service 可用性":"Dart Heap data and manual GC require VM Service connection. When VM Service is unavailable, these features gracefully degrade to show \"N/A\".Dart Heap 数据和手动 GC 需要 VM Service 连接。 VM Service 不可用时,这些功能优雅降级显示 \"N/A\"。","when-debugging-via-pc-with-flutter-run--通过-pc-用-flutter-run-调试时#When debugging via PC with flutter run / 通过 PC 用 flutter run 调试时":"Dart VM Heap data may be unavailable (VM: OFF).Dart VM Heap 数据可能不可用(VM: OFF)。Reason / 原因: When using flutter run to debug via PC, the flutter tool sets up port forwarding between PC and device via adb reverse, allowing PC-side DevTools to access the device's VM Service. However, Service.getInfo() returns a serverUri from the PC's perspective; when the app process internally accesses 127.0.0.1:PC_port, the device doesn't have that port listening locally, resulting in Connection refused and VM Service showing OFF.原因:使用 flutter run 连接 PC 调试时,flutter tool 会通过 adb reverse 在 PC 和设备之间做端口转发,让 PC 上的 DevTools 能访问设备的 VM Service。但应用进程内部 Service.getInfo() 返回的 serverUri 是 PC 视角的端口,应用进程访问 127.0.0.1:PC端口 时设备本地并没有监听该端口,导致 Connection refused,VM Service 显示 OFF。","when-opening-debug-app-directly-no-pc--直接打开-debug-应用不连-pc#When opening debug app directly (no PC) / 直接打开 debug 应用(不连 PC)":"VM Service works normally. No flutter tool is involved, VM Service listens directly on the device's local port, the app can connect normally, and Dart Heap data displays correctly.VM Service 正常工作。 没有 flutter tool 介入,VM Service 直接监听设备本地端口,应用能正常连接,Dart Heap 数据正常显示。","fallback--降级方案#Fallback / 降级方案":"When VM Service is unavailable:\n✅ Native memory (Android PSS / iOS physicalFootprint) — still available\n✅ Process RSS — always available\n✅ Image cache / storage stats — still available\n✅ Leak detection — still available (doesn't depend on VM Service)\n❌ Dart Heap details — shows N/A\n❌ Manual GC — button disabled","platform-support--平台支持#Platform Support / 平台支持":"Feature\tAndroid\tiOS\tProcess RSS\t✅\t✅\tNative Memory\t✅\t✅\tDart Heap (VM Service)\t✅ (no PC)\t✅ (no PC)\tManual GC\t✅ (no PC)\t✅ (no PC)\tLeak Detection\t✅\t✅\tImage Cache\t✅\t✅\tStorage Stats\t✅\t✅","refresh-intervals--刷新间隔#Refresh Intervals / 刷新间隔":"Data Source\tInterval\tProcess RSS / Dart Heap\t500ms\tNative Memory (Android/iOS)\t3000ms\tStorage Stats\t3000ms\tLeak Detection\t2000ms","related--相关#Related / 相关":"Usage — General usage guide\nFAQ — Common questions\nConfiguration — Configuration options"}},"/Route-Tracker":{"title":"Route Tracker / 路由追踪","data":{"overview--概述#Overview / 概述":"The Route Tracker monitors navigation history, recording all route push, pop, and replacement events.路由追踪器监控导航历史,记录所有路由 push、pop 和替换事件。","auto-injection--自动注入#Auto-Injection / 自动注入":"When using runAppWithInspector() or wrapApp(), the InspectorRouteObserver is automatically injected into MaterialApp's navigatorObservers.使用 runAppWithInspector() 或 wrapApp() 时,InspectorRouteObserver 会自动注入到 MaterialApp 的 navigatorObservers 中。","tracked-route-actions--追踪的路由操作#Tracked Route Actions / 追踪的路由操作":"Action\tColor\tDescription\tpush\tBlue\tNavigator.push() / 推入新路由\tpushNamed\tBlue\tNavigator.pushNamed() / 按名称推入\tpop\tOrange\tNavigator.pop() / 弹出路由\tpopUntil\tOrange\tNavigator.popUntil() / 弹出直到\tpushReplacement\tPurple\tNavigator.pushReplacement() / 替换路由","ui-features--ui-功能#UI Features / UI 功能":"","route-list--路由列表#Route List / 路由列表":"Action badge with color / 带颜色的操作徽章\nRoute name display / 路由名称显示\nTimestamp display / 时间戳显示\nLeft border color indicates action type / 左侧边框颜色表示操作类型","route-detail--路由详情#Route Detail / 路由详情":"Click a route to view details / 点击路由查看详情\nShows: Action, Route Name, Timestamp, Arguments / 显示:操作、路由名、时间戳、参数\nArguments displayed as formatted JSON / 参数以 JSON 格式显示","manual-setup-optional--手动设置可选#Manual Setup (Optional) / 手动设置(可选)":"If you use a custom Navigator or don't use MaterialApp, add the observer manually:如果使用自定义 Navigator 或不使用 MaterialApp,请手动添加观察者:\nMaterialApp(\n navigatorObservers: [InspectorRouteObserver()],\n home: MyHomePage(),\n)"}},"/Network-Inspector":{"title":"Network Inspector / 网络检查器","data":{"overview--概述#Overview / 概述":"The Network Inspector automatically captures all HTTP requests made via the http package and Dio, with zero configuration needed.网络检查器自动捕获所有通过 http 包 和 Dio 发送的 HTTP 请求,无需任何配置。","how-it-works--工作原理#How It Works / 工作原理":"The inspector uses Flutter's HttpOverrides to intercept all HTTP traffic at the dart:io level. This means:检查器通过 Flutter 的 HttpOverrides 在 dart:io 层面拦截所有 HTTP 流量。这意味着:\nhttp package: Auto-captured ✅ / 自动捕获 ✅\nDio: Auto-captured (uses IOHttpClientAdapter → HttpClient) ✅ / 自动捕获 ✅\nNo manual interceptor setup needed / 无需手动添加拦截器","websocket--grpc-capture--websocket-与-grpc-抓取#WebSocket & gRPC Capture / WebSocket 与 gRPC 抓取":"Available since v1.7.0 (opt-in, off by default)v1.7.0 起可用(可选开启,默认关闭)\nHTTP/HTTPS traffic is captured automatically, but the HttpOverrides interceptor does not cover streaming protocols like WebSocket and gRPC. For those, enable the opt-in capture so frames and calls show up as WS / gRPC rows in the Network tab.HTTP/HTTPS 流量会自动捕获,但 HttpOverrides 拦截器无法覆盖 WebSocket、gRPC 这类流式协议。针对它们需开启可选的抓取,开启后收发帧/调用会以 WS / gRPC 行的形式出现在 Network 标签页。","enable--开启方式#Enable / 开启方式":"Toggle the WS switch in the Network tab toolbar, or / 在 Network 标签页工具栏点击 WS 开关,或\nSet it programmatically: / 通过代码开启:\n// on / 开启\nWsInspectorService.instance.enable();\n// off / 关闭\nWsInspectorService.instance.disable();\nCapture is off by default and only records while enabled — apps that don't use these protocols pay nothing.抓取默认关闭,且只在开启时记录;不使用这类协议的应用零开销。","two-usage-modes--两种使用方式#Two Usage Modes / 两种使用方式":"1. Transparent wrapper — InspectorWebSocketReplace WebSocket.connect with InspectorWebSocket.connect. Frames are auto-recorded (→ out, ← in) when capture is on; when off it passes through with zero overhead.将 WebSocket.connect 替换为 InspectorWebSocket.connect。开启抓取时会自动记录收发帧(→ 出站、← 入站);关闭时零开销透传。\nfinal ws = await InspectorWebSocket.connect('wss://echo.websocket.events');\nws.listen((msg) => print('received: $msg'));\nws.add('hello'); // recorded as an outgoing frame / 记录为出站帧\n2. Manual hook — recordCallFor stacks not transparently interceptable by dart:io (gRPC, web_socket_channel, custom protocols), call recordCall to log a request/response pair. No-ops when capture is disabled.对于无法被 dart:io 透明拦截的栈(gRPC、web_socket_channel、自定义协议),调用 recordCall 记录一次请求/响应。关闭抓取时为空操作。\nWsInspectorService.instance.recordCall(\n name: 'user.UserService/GetUser',\n request: '{ \"id\": 1 }',\n response: '{ \"name\": \"Ada\" }',\n protocol: 'gRPC', // appears in the method column / 显示在 method 列\n);","what-you-see--查看方式#What You See / 查看方式":"Network tab lists a WS (or gRPC) entry per connection/call / Network 标签页按连接/调用列出 WS(或 gRPC)记录\nOpen the detail view to see the frame log (outgoing → / incoming ←), accumulated in the response body / 进入详情页查看帧日志(出站 → / 入站 ←),累积显示在响应体中\nA [connection closed] marker is appended when the socket closes / 连接关闭后会追加 [connection closed] 标记","captured-information--捕获的信息#Captured Information / 捕获的信息":"Field\tDescription\tMethod\tGET, POST, PUT, DELETE, PATCH\tURL\tFull request URL\tStatus Code\tHTTP response status code\tDuration\tRequest duration\tRequest Headers\tAll request headers\tRequest Body\tRequest payload (JSON formatted)\tResponse Body\tResponse payload (JSON formatted)\tHost\tParsed from URL","ui-features--ui-功能#UI Features / UI 功能":"","request-list--请求列表#Request List / 请求列表":"Color-coded by HTTP method / 按 HTTP 方法着色\nStatus code badge / 状态码徽章\nDuration display / 耗时显示\nLeft border color indicates status / 左侧边框颜色表示状态","request-detail--请求详情#Request Detail / 请求详情":"Click a request to enter detail view / 点击请求进入详情视图\nBack button to return to list / 返回按钮返回列表\nRequest and response sections / 请求和响应分段显示\nJSON formatted body / JSON 格式化显示","search--搜索#Search / 搜索":"Fuzzy search by URL or method / 按 URL 或方法模糊搜索\nSearch bar hidden in detail view / 详情视图隐藏搜索栏","batch-operations--批量操作#Batch Operations / 批量操作":"Available since v1.3.0v1.3.0 起可用\nThe request list supports a selection mode for operating on multiple requests at once.请求列表支持选择模式,可一次性操作多条请求。\nTap the selection icon in the toolbar to enter selection mode / 点击工具栏的选择图标进入选择模式\nCheck/uncheck items; a top batch bar shows Select all / Cancel / 勾选/取消勾选;顶部批量条提供全选 / 取消\nBatch \"Copy as cURL\": copies all selected requests as cURL commands / 批量「Copy as cURL」:将所有选中请求复制为 cURL 命令\nBatch delete: removes selected requests from the list / 批量删除:从列表中移除选中请求","export--sensitive-field-masking--导出与敏感字段遮蔽#Export & Sensitive-field Masking / 导出与敏感字段遮蔽":"Available since v1.3.0v1.3.0 起可用\nThe toolbar includes an eye toggle that controls whether sensitive headers are masked on export.工具栏包含眼睛开关,控制导出时是否遮蔽敏感请求头。\nDefault: off (fully visible) — cURL / JSON / HAR reflect the real request verbatim / 默认关闭(完整可见):cURL / JSON / HAR 原样反映真实请求\nOn: toCurl / netToJson / netToHar / copyNet / exportNetToFile mask these headers / 开启后:以下请求头被遮蔽:\nAuthorization, Cookie, Set-Cookie, Proxy-Authorization, X-Auth-Token, X-CSRF-Token, X-XSRF-Token\nThe detail page \"Copy as cURL\" / \"Copy as JSON\" follow the same toggle / 详情页「Copy as cURL」「Copy as JSON」跟随同一开关\nWhen masking is active, the snackbar notes (sensitive hidden) / 遮蔽开启时,snackbar 提示 (sensitive hidden)\nTip: keep masking on before pasting cURL/JSON into terminals, chat, or issue trackers to avoid leaking credentials.提示:将 cURL/JSON 粘贴到终端、聊天或 issue 前,建议开启遮蔽,避免凭据泄露。","copy-as-curl--复制为-curl#Copy as cURL / 复制为 cURL":"Available since v1.3.0v1.3.0 起可用\nFrom the request detail view, tap Copy as cURL to copy the request as a ready-to-run cURL command (method, URL, headers, body). Respects the sensitive-field masking toggle above.在请求详情页点击 Copy as cURL,即可将请求复制为可直接运行的 cURL 命令(方法、URL、请求头、请求体),并遵循上方的敏感字段遮蔽开关。","replay-editor--重放编辑器#Replay Editor / 重放编辑器":"Available since v1.11.0v1.11.0 起可用\nEvery request detail view has a replay action (↻ icon). It opens an editable sheet that lets you re-issue the captured request in-app and preview the response — handy for quickly re-running an endpoint without leaving the app.每个请求详情页都有重放操作(↻ 图标)。它会打开一个可编辑弹层,让你在 App 内重新发出该请求并预览响应——无需离开应用即可快速复跑某个接口。\nOnly the URL query parameters are editable — add / edit / remove key=value rows; the URL is rebuilt from them on send / 仅 URL 查询参数可编辑——可增删改 key=value 行,发送时用其重建 URL\nURL, request headers and request body are read-only by design (the captured values are re-sent verbatim) / URL、请求头与请求体按设计只读(以捕获到的原值原样重发)\nOn Send, the request is re-issued with the original method / headers / body and the edited query string; the sheet shows the returned status code, elapsed time, and a response preview / 点击 Send 后用原始方法 / 请求头 / 请求体加上修改后的查询串重新发出,弹层展示返回状态码、耗时与响应预览\nThis is distinct from the interceptor (which builds a durable modification rule applied to future matching requests). The replay editor makes a one-off call with editable query params — including GET requests, whose params can't be changed by the interceptor.它与拦截器不同(拦截器生成作用于后续匹配请求的持久规则)。重放编辑器发起的是一次性调用,仅查询参数可改——包括 GET 请求(其参数拦截器无法修改)。","status-code-colors--状态码颜色#Status Code Colors / 状态码颜色":"Range\tColor\tDescription\t2xx\tGreen\tSuccess / 成功\t3xx\tBlue\tRedirect / 重定向\t4xx\tOrange\tClient error / 客户端错误\t5xx\tRed\tServer error / 服务器错误","http-method-colors--http-方法颜色#HTTP Method Colors / HTTP 方法颜色":"Method\tColor\tGET\tBlue / 蓝色\tPOST\tGreen / 绿色\tPUT\tOrange / 橙色\tDELETE\tRed / 红色\tPATCH\tPurple / 紫色","usage-example--使用示例#Usage Example / 使用示例":"// http package - auto-captured / http 包 - 自动捕获\nfinal response = await http.get(\n Uri.parse('https://api.example.com/data'),\n);\n// Dio - auto-captured / Dio - 自动捕获\nfinal response = await dio.post(\n 'https://api.example.com/data',\n data: {'key': 'value'},\n);\nNo additional setup required! All requests will appear in the Network tab.无需额外配置!所有请求都会出现在 Network 标签页中。","request-interceptor--请求拦截修改#Request Interceptor / 请求拦截修改":"Available since v1.0.7 (response fields locked to read-only since v1.0.8)v1.0.7 起可用(v1.0.8 起响应字段锁定为只读)\nThe inspector supports intercepting and modifying network requests via rules. This is useful for testing different request parameters without modifying app code.检查器支持通过规则拦截并修改网络请求,适合在不修改应用代码的情况下测试不同的请求参数。","workflow--工作流程#Workflow / 工作流程":"Send a request normally (it will be captured in the Network panel) / 正常发送请求(会被捕获到 Network 面板)\nOpen the request detail and tap the Interceptor icon / 打开请求详情,点击拦截器图标\nConfigure the modification rule (URL pattern, HTTP method, request modifications) / 配置修改规则(URL 模式、HTTP 方法、请求修改)\nSave the rule — subsequent matching requests will use the modified parameters / 保存规则——后续匹配的请求将使用修改后的参数","supported-modifications--支持的修改#Supported Modifications / 支持的修改":"Field\tEditable\tNotes\tRequest Body\t✅\tOnly for requests with body (POST, PUT, PATCH, etc.) / 仅适用于有 body 的请求\tRequest Headers\t✅\tAdd / modify / remove headers / 新增 / 修改 / 删除请求头\tURL\t❌\tGrayed out, read-only / 灰色不可编辑\tResponse Status Code\t❌\tRead-only since v1.0.8 / v1.0.8 起只读\tResponse Body\t❌\tRead-only since v1.0.8 / v1.0.8 起只读\t\nThe interception edit panel only allows modifying the request body and request headers. Response fields (status code, response body) are grayed out and uneditable.拦截编辑面板仅允许修改请求体和请求头。响应字段(状态码、响应体)灰色不可编辑。","rule-matching--规则匹配#Rule Matching / 规则匹配":"URL pattern matching: exact match or regex / URL 模式匹配:精确匹配或正则匹配\nHTTP method filtering: GET, POST, PUT, DELETE, PATCH, HEAD, or Any / HTTP 方法过滤","why-get-requests-cannot-be-modified--为什么-get-请求不能修改#Why GET Requests Cannot Be Modified / 为什么 GET 请求不能修改":"The interceptor currently supports modifying request body and headers only / 拦截器目前仅支持修改请求体和请求头\nGET requests don't have a request body / GET 请求没有请求体\nModifying GET request parameters would require URL modification / 修改 GET 请求参数需要修改 URL\nURL modification may cause unexpected issues with request routing and parameter encoding / 修改 URL 可能导致请求路由和参数编码的意外问题\nGET request detail pages do not display interception edit buttons, making them unmodifiable.GET 请求详情页不显示拦截编辑按钮,因此无法修改。","master-toggle--拦截总开关#Master Toggle / 拦截总开关":"The interception master toggle is displayed only on the Network list page, not in the detail page / 拦截总开关只显示在 Network 列表页,不在详情页\nRules are only applied when modification mode is enabled / 规则仅在启用修改模式时生效\nWhen no rules are configured or rules are disabled, all requests are sent normally without any modification / 未配置规则或禁用规则时,所有请求正常发送,不做任何修改","rule-management--规则管理#Rule Management / 规则管理":"The network panel includes an interceptor rule editor where you can:网络面板包含拦截规则编辑器,可以:\nCreate / edit / delete rules / 创建 / 编辑 / 删除规则\nEnable / disable individual rules / 启用 / 禁用单条规则\nView rule status indicators in the request list / 在请求列表中查看规则状态标识"}},"/Timeline":{"title":"Timeline / 统一会话时间线","data":{"overview--概述#Overview / 概述":"The Timeline tab merges network, logs, errors, routes, and alerts into a single time-ordered stream, so you can see the full causal chain of a session at a glance — e.g. \"route push → two requests → error log → 5xx alert\". Each source keeps its own data; the Timeline view only merges them for display.统一会话时间线把网络、日志、异常、路由、告警归并为一条按时间排序的流,让你一眼看清一次会话的完整因果链——例如「路由跳转 → 两个请求 → error 日志 → 5xx 告警」。各来源的数据仍归属各自服务,时间线视图只做归并显示。\nAvailable since v1.12.0v1.12.0 起可用","where-to-find-it--入口#Where to find it / 入口":"Tap the floating inspector button → the Timeline tab (located after Routes and before Widgets in the panel).点击悬浮检查器按钮 → Timeline 标签页(位于面板中 Routes 之后、Widgets 之前)。","features--功能#Features / 功能":"","1-merged-stream--归并流#1. Merged stream / 归并流":"Network / Logs / Errors / Routes / Alerts appear interleaved by timestamp / 网络 / 日志 / 异常 / 路由 / 告警按时间戳交错排列\nEach entry shows its source icon, a colored left accent bar, timestamp, and a concise summary / 每条显示来源图标、左侧彩色强调条、时间戳与精炼摘要\nTap any entry to expand details (e.g. request URL/status, log level/message, route action/name) / 点击任意条目展开详情(如请求 URL/状态、日志级别/内容、路由操作/名称)\n把五类数据按时间归并,每条带来源图标、彩色强调条、时间戳与摘要,可点击展开。","2-per-source-filtering--逐来源筛选#2. Per-source filtering / 逐来源筛选":"Toggle each source on/off to focus on the ones you care about / 逐来源开关,只看关心的来源\nFiltering only hides entries from the merged view; underlying data is untouched / 筛选只隐藏归并视图中的条目,底层数据不受影响\n顶部可按来源开关自由筛选,归并显示内容随之变化,底层数据不变。","3-focus-n-seconds--n-秒聚焦#3. Focus ±N seconds / ±N 秒聚焦":"Tap any event to enter \"focus\" mode: the view keeps only events within ±N seconds of the anchor / 点击任意事件进入「聚焦」模式,仅保留锚点前后 ±N 秒内的事件\nWindow selector: 5s / 10s (default) / 30s / 窗口可选:5s / 10s(默认)/ 30s\nGreat for isolating the exact cause-effect around a failure (e.g. what happened right before a 5xx alert) / 适合隔离某次失败前后的精确因果(如 5xx 告警前到底发生了什么)\n点击任意事件即可「聚焦它前后 ±N 秒」,把噪音过滤掉,只留因果相关事件。","how-it-works--工作原理#How It Works / 工作原理":"View-only merge — TimelineService.build() reads from InspectorService (network / logs / errors), RouteTrackerService, and AlertService, sorts them by time, and tags each with its TimelineEventKind. It does not copy or own any data. / 仅视图归并:TimelineService.build() 从各服务读取数据、按时间排序并打上来源标签,不复制、不持有数据。\nZero cost when closed — no timers, no listeners, no polling while the panel is not open; the merge runs on demand when you open the Timeline tab. / 面板关闭时零开销:未打开面板时不跑定时器、不监听、不轮询,仅在打开 Timeline 时按需归并。\ncontextAround(anchor, window) — given an anchor event and a Duration window, returns the slice of events whose timestamp falls within [anchor - window, anchor + window], oldest-first. / 给定锚点事件与窗口时长,返回落在 [锚点 - 窗口, 锚点 + 窗口] 内的事件,按时间升序。","related--相关#Related / 相关":"Usage — General usage guide / 通用使用指南\nFPS Viewer — Includes the main-thread blocking watchdog / 含主线程阻塞看门狗\nRoute Tracker — Route tracking details / 路由追踪详情"}},"/":{"title":"Zero Inspector Kit","data":{"":"A powerful Flutter plugin for in-app developer console, providing real-time debugging tools including network request inspection, logging, error aggregation, database viewing, and route tracking.一个功能强大的 Flutter 插件,提供应用内开发者控制台,包括网络请求检查、日志记录、异常聚合、数据库查看和路由追踪。","-features--功能特性#✨ Features / 功能特性":"Feature\tDescription\tZero Invasion\tIntegrate with 1 line of code / 一行代码集成\tNetwork Inspector\tReal-time HTTP request viewing (http + Dio) / 实时网络请求查看\tLog Viewer\tAuto-capture print()/debugPrint() and third-party logs / 自动捕获日志\tErrors\tAggregate & dedupe crashes by type + stack, with count and first/last seen / 按类型+堆栈去重聚合崩溃,记录次数与首末次时间\tDatabase Viewer\tSQLite inspection with table data / 数据库查看\tMemory Viewer\tTrend chart, Dart Heap, Native memory, leak detection (incl. Flutter MemoryAllocations bridge) / 内存趋势图、Dart Heap、Native 内存、泄漏检测(含官方 MemoryAllocations 桥接)\tFPS Monitor\tReal-time FPS, jank rate, trend chart / 实时 FPS、卡顿率、趋势图\tRoute Tracker\tNavigation history tracking / 路由追踪\tSession Timeline\tUnified view of network/logs/errors/routes/alerts by time, with ±N-second focus / 网络/日志/异常/路由/告警按时间归并,支持 ±N 秒聚焦\tSession Persistence\tLogs/network/errors survive restarts via a disk ring buffer; logs & errors replay on launch; one-tap session archive export / 日志/网络/异常通过磁盘环形缓冲跨重启保留,启动时回放日志与异常;一键导出会话存档\tAlerts\tRule-based alerts (network/log/memory/FPS) with unread badge / 基于规则的告警(网络/日志/内存/FPS)与未读角标\tSensitive Masking & cURL\tMask secrets on export; one-click cURL copy; batch ops / 导出遮蔽敏感字段、一键复制 cURL、批量操作\tFuzzy Search\tSearch in all viewers / 各查看器模糊搜索\tCross-platform\tAndroid, iOS / 跨平台支持","-table-of-contents--目录#📚 Table of Contents / 目录":"Page\tDescription\tGetting Started\tQuick start guide / 快速开始\tInstallation\tHow to install / 安装方式\tUsage\tDetailed usage / 详细使用\tNetwork Inspector\tNetwork request viewing / 网络检查器\tLog Viewer\tLog capturing and viewing / 日志查看器\tErrors\tAggregated error viewing / 异常聚合查看\tDatabase Viewer\tDatabase inspection / 数据库查看器\tRoute Tracker\tRoute tracking / 路由追踪\tTimeline\tUnified session timeline / 统一会话时间线\tMemory Viewer\tMemory monitoring & leak detection / 内存监控与泄漏检测\tFPS Viewer\tFPS monitoring & jank detection / FPS 监控与卡顿检测\tAlerts\tRule-based alerting / 基于规则的告警\tConfiguration\tConfiguration options / 配置说明\tCustom Database Provider\tExtend database support / 自定义数据库提供者\tFAQ\tFrequently asked questions / 常见问题","-links--链接#🔗 Links / 链接":"GitHub\nOfficial Website\npub.dev","-license--许可证#📄 License / 许可证":"This project is licensed under the GNU General Public License v3.0.本项目采用 GNU General Public License v3.0 许可证。This plugin is provided \"as is\", without warranty of any kind. The author assumes no responsibility or liability for the functionality, security, or any consequences arising from the use of modified versions or derivative projects.本插件按\"原样\"提供,不提供任何担保。作者不对修改版或衍生项目的功能、安全性及任何使用后果承担责任。"}},"/Usage":{"title":"Usage / 使用指南","data":{"integration-methods--集成方式#Integration Methods / 集成方式":"","1-one-line-integration-recommended--一行代码集成推荐#1. One-Line Integration (Recommended) / 一行代码集成(推荐)":"void main() {\n ZeroInspectorKit.runAppWithInspector(const MyApp());\n}\nThis method:\nAuto-initializes inspector / 自动初始化检查器\nCaptures print() via Zone / 通过 Zone 捕获 print()\nDisplays floating button via Overlay / 通过 Overlay 显示悬浮按钮\nAuto-injects route observer / 自动注入路由观察者","2-two-line-integration--两行代码集成#2. Two-Line Integration / 两行代码集成":"void main() {\n ZeroInspectorKit.init();\n runApp(ZeroInspectorKit.wrapApp(const MyApp()));\n}","inspector-panel--检查器面板#Inspector Panel / 检查器面板":"The inspector panel contains 10 tabs (as of v1.12.0):检查器面板包含 10 个标签页(v1.12.0 起):\nTab\tIcon\tFeature\tNetwork\t🌐\tHTTP request viewing + interceptor rules / 网络请求查看 + 拦截修改\tLogs\t📝\tLog viewing with level filter / 日志查看\tErrors\t🚨\tAggregated & deduped crash viewing / 去重聚合的异常查看\tDatabase\t💾\tDatabase and table inspection / 数据库查看\tMemory\t📊\tMemory trend, Dart Heap, Native memory, leak detection / 内存趋势、Dart Heap、Native 内存、泄漏检测\tFPS\t🎯\tReal-time FPS, jank rate, trend chart, plus main-thread blocking watchdog / 实时 FPS、卡顿率、趋势图,以及主线程阻塞看门狗\tRoutes\t🧭\tRoute navigation tracking / 路由追踪\tTimeline\t🧵\tUnified session timeline: network / logs / errors / routes / alerts merged into one stream, with ±N-second focus / 统一会话时间线:网络/日志/异常/路由/告警按时间归并,支持 ±N 秒聚焦\tWidgets\t🔍\tWidget tree snapshot for the current route / 当前路由的 Widget 树快照\tAlerts\t🔔\tRule-based alerts with unread badge / 基于规则的告警与未读角标\t\nThe Memory and FPS monitors are off by default to avoid performance overhead. Toggle the switch at the top of each panel to start collecting data.Memory 与 FPS 监控默认关闭以避免性能开销。在各自面板顶部打开开关才会开始采集数据。","one-click-bug-report--一键-bug-报告#One-Click Bug Report / 一键 Bug 报告":"Tap the bug icon in the inspector panel header to generate and share a bug report in one tap — ideal for QA to attach environment context when filing issues.点击检查器面板头部的虫子图标,即可一键生成并分享一份 Bug 报告——非常适合 QA 在提 issue 时附上环境上下文。The shared text snapshot includes / 分享的文本快照包含:\nDevice / 设备: real model (e.g. Pixel 8 Pro / iPhone (iPhone16,1)), OS & version, locale, Dart runtime, CPU cores.\nMemory / 内存: current heap usage and whether Native memory is supported.\nRecent logs / 最近日志: the latest captured log entries.\nRecent network / 最近网络: the latest captured requests.\nSensitive headers are masked the same way as in the Network tab. No data leaves the device except through the share target you choose.敏感请求头会与网络标签页一样被遮蔽。除你选择的分享目标外,数据不会离开设备。\nRequires no extra setup — it works as soon as the inspector is running. / 无需额外配置——检查器运行后即可使用。","floating-button--悬浮按钮#Floating Button / 悬浮按钮":"The floating button appears after 1 second delay / 悬浮按钮延迟 1 秒出现\nDrag to move it along the screen edge / 拖动 可沿屏幕边缘移动\nTap (when fully visible) to open/close the inspector panel / 点击(完全可见时)打开/关闭检查器面板\nButton auto-snaps to the nearest screen edge / 按钮自动吸附到最近的屏幕边缘\nBreathing animation when idle / 空闲时有呼吸动画","edge-docking-since-v120--边缘吸附v120-起#Edge Docking (since v1.2.0) / 边缘吸附(v1.2.0 起)":"When released near a screen edge, the button auto-docks and tucks into the edge, leaving only a 24px peek visible:拖动松手后,按钮会自动吸附到最近边缘并\"收入\"边缘,仅露出 24px 小弧边:\nState\tBehavior / 行为\tDocked (tucked in)\tOnly 24px peek visible; icon becomes a directional chevron (left dock → ➡, right dock → ⬅) hinting at tap-to-pull-out / 仅露出 24px;图标变为方向箭头提示可点击拉出\tTap docked peek\tSmoothly pulls out to fully visible (panel NOT opened, avoids accidental open) / 平滑拉出到完全可见(不打开面板,避免误触)\tTap fully visible\tOpens the inspector panel / 打开检查器面板\t\nThis design avoids conflicts with system back gestures (Android/iOS edge swipe to go back) when pulling out from the docked state.此设计避免了从吸附态拖出时与系统返回手势(Android/iOS 边缘右滑退出)的冲突。","search--搜索#Search / 搜索":"The main viewers support fuzzy search:各查看器均支持模糊搜索:\nViewer\tSearch Scope\tNetwork\tURL, HTTP method / URL、请求方法\tLogs\tMessage, tag / 消息、标签\tErrors\tException type, message / 异常类型、消息\tDatabase (global)\tDatabase name, table name / 数据库名、表名\tDatabase (in-database)\tTable name, all column data / 表名、所有列数据","manual-logging-optional--手动记录日志可选#Manual Logging (Optional) / 手动记录日志(可选)":"The inspector auto-captures print() output. You can also use manual log methods for precise level control:检查器会自动捕获 print() 输出。也可以使用手动日志方法进行精确级别控制:Quick shorthand (recommended) / 简化写法(推荐):\nInspectorLog.v('Verbose log / 详细日志');\nInspectorLog.d('Debug log / 调试日志');\nInspectorLog.i('Info log / 信息日志');\nInspectorLog.w('Warning log / 警告日志');\nInspectorLog.e('Error log / 错误日志');\nFull form / 完整写法:\nInspectorLogInterceptor.instance.verbose('Verbose log / 详细日志');\nInspectorLogInterceptor.instance.debug('Debug log / 调试日志');\nInspectorLogInterceptor.instance.info('Info log / 信息日志');\nInspectorLogInterceptor.instance.warning('Warning log / 警告日志');\nInspectorLogInterceptor.instance.error('Error log / 错误日志');","third-party-log-integration--第三方日志库集成#Third-Party Log Integration / 第三方日志库集成":"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 级别。","bidirectional-sync-optional--双向同步可选#Bidirectional Sync (Optional) / 双向同步(可选)":"To sync inspector-captured logs to your third-party logger:将检查器捕获的日志同步到第三方日志库:\nInspectorLogInterceptor.instance.onLogCaptured = (entry) {\n yourLogger.log(entry.message);\n};","feature-pages--功能详情#Feature Pages / 功能详情":"Network Inspector — Network request details + interceptor rules / 网络检查器详情 + 拦截修改\nLog Viewer — Log viewing details / 日志查看器详情\nErrors — Aggregated error viewing / 异常聚合查看\nDatabase Viewer — Database inspection details / 数据库查看器详情\nRoute Tracker — Route tracking details / 路由追踪详情\nMemory Viewer — Memory monitoring & leak detection / 内存监控与泄漏检测\nFPS Viewer — FPS monitoring & jank detection / FPS 监控与卡顿检测","session-persistence--会话持久化#Session Persistence / 会话持久化":"Logs, network requests, and aggregated errors are asynchronously flushed to a local SQLite ring buffer. On the next launch, logs and aggregated errors replay into their tabs; network requests stay archived on disk for later export. Data therefore survives app restarts even if the inspector panel was never opened. Tap the storage icon in the panel header to open the Persisted data manager: view row counts per category, export the full session archive, or clear the disk. See Configuration (PersistenceService section) for the API and tuning parameters.日志、网络请求与聚合异常会被异步写入本地 SQLite 环形缓冲。下次启动时,日志与聚合异常会回放入各自标签页;网络请求保留在磁盘存档,供之后导出。因此即使从未打开过检查器面板,数据也能跨重启保留。点击面板头部的存储图标可打开 Persisted data 管理弹层:查看各类别行数、导出完整会话存档或清空磁盘。API 与调参详见 Configuration(PersistenceService 一节)。"}}} \ No newline at end of file diff --git a/docs/_next/static/chunks/pages/Installation-048a2c75d4cde1c5.js b/docs/_next/static/chunks/pages/Installation-451e2c8dbda34e0e.js similarity index 98% rename from docs/_next/static/chunks/pages/Installation-048a2c75d4cde1c5.js rename to docs/_next/static/chunks/pages/Installation-451e2c8dbda34e0e.js index 4fc4f54..2098c79 100644 --- a/docs/_next/static/chunks/pages/Installation-048a2c75d4cde1c5.js +++ b/docs/_next/static/chunks/pages/Installation-451e2c8dbda34e0e.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[139],{9720:function(e,i,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/Installation",function(){return t(1220)}])},1220:function(e,i,t){"use strict";t.r(i),t.d(i,{useTOC:function(){return l}});var r=t(5893),n=t(7812),s=t(7080),a=t(8925),d=t(5192);function l(e){return[{value:"From pub.dev (Recommended) / 从 pub.dev 安装(推荐)",id:"from-pubdev-recommended--从-pubdev-安装推荐",depth:2},{value:"From GitHub / 从 GitHub 安装",id:"from-github--从-github-安装",depth:2},{value:"Platform Setup / 平台配置",id:"platform-setup--平台配置",depth:2},{value:"Android",id:"android",depth:3},{value:"iOS",id:"ios",depth:3},{value:"Import / 导入",id:"import--导入",depth:2},{value:"Requirements / 环境要求",id:"requirements--环境要求",depth:2},{value:"Next Steps / 下一步",id:"next-steps--下一步",depth:2}]}i.default=(0,n.c)(function(e){let{toc:i=l(e)}=e,t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",span:"span",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,a.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h1,{children:"Installation / 安装"}),"\n",(0,r.jsx)(t.h2,{id:i[0].id,children:i[0].value}),"\n",(0,r.jsxs)(t.p,{children:["Add the following to your ",(0,r.jsx)(t.code,{children:"pubspec.yaml"}),":"]}),"\n",(0,r.jsxs)(t.p,{children:["在 ",(0,r.jsx)(t.code,{children:"pubspec.yaml"})," 中添加以下依赖:"]}),"\n",(0,r.jsx)(t.pre,{tabIndex:"0","data-language":"yaml","data-word-wrap":"","data-copy":"",children:(0,r.jsxs)(t.code,{children:[(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:"dependencies"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:":"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" zero_inspector_kit"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": "}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"^1.13.0"})]})]})}),"\n",(0,r.jsx)(t.p,{children:"Then run:"}),"\n",(0,r.jsx)(t.p,{children:"然后运行:"}),"\n",(0,r.jsx)(t.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,r.jsx)(t.code,{children:(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"flutter"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" pub"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" get"})]})})}),"\n",(0,r.jsx)(t.h2,{id:i[1].id,children:i[1].value}),"\n",(0,r.jsx)(t.p,{children:"Alternatively, install from GitHub:"}),"\n",(0,r.jsx)(t.p,{children:"或者从 GitHub 安装:"}),"\n",(0,r.jsx)(t.pre,{tabIndex:"0","data-language":"yaml","data-word-wrap":"","data-copy":"",children:(0,r.jsxs)(t.code,{children:[(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:"dependencies"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:":"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" zero_inspector_kit"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:":"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" git"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:":"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" url"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": "}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"https://github.com/zero-labsco/zero_inspector_kit.git"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" ref"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": "}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"release/v1.13.0"})]})]})}),"\n",(0,r.jsx)(t.h2,{id:i[2].id,children:i[2].value}),"\n",(0,r.jsx)(t.h3,{id:i[3].id,children:i[3].value}),"\n",(0,r.jsx)(t.p,{children:"No additional configuration needed."}),"\n",(0,r.jsx)(t.p,{children:"无需额外配置。"}),"\n",(0,r.jsx)(t.h3,{id:i[4].id,children:i[4].value}),"\n",(0,r.jsx)(t.p,{children:"No additional configuration needed."}),"\n",(0,r.jsx)(t.p,{children:"无需额外配置。"}),"\n",(0,r.jsx)(t.h2,{id:i[5].id,children:i[5].value}),"\n",(0,r.jsx)(t.pre,{tabIndex:"0","data-language":"dart","data-word-wrap":"","data-copy":"",children:(0,r.jsx)(t.code,{children:(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'package:zero_inspector_kit/zero_inspector_kit.dart'"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";"})]})})}),"\n",(0,r.jsx)(t.h2,{id:i[6].id,children:i[6].value}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Requirement"}),(0,r.jsx)(t.th,{children:"Version"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"Flutter"}),(0,r.jsx)(t.td,{children:">= 3.3.0"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"Dart SDK"}),(0,r.jsx)(t.td,{children:">= 3.11.0 < 4.0.0"})]})]})]}),"\n",(0,r.jsx)(t.h2,{id:i[7].id,children:i[7].value}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.a,{href:"Getting-Started",children:"Getting Started"})," — Quick start guide / 快速开始"]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.a,{href:"Usage",children:"Usage"})," — Full usage guide / 完整使用指南"]}),"\n"]})]})},"/Installation",{filePath:"pages/Installation.md",timestamp:178793305e4,pageMap:s.v,frontMatter:{},title:"Installation / 安装"},"undefined"==typeof RemoteContent?l:RemoteContent.useTOC)},7080:function(e,i,t){"use strict";t.d(i,{v:function(){return r}});let r=[{data:{index:"\uD83C\uDFE0 Home","Getting-Started":"\uD83D\uDE80 Getting Started",Installation:"\uD83D\uDCE6 Installation",Usage:"\uD83D\uDCD6 Usage","--features":{type:"separator",title:"\uD83D\uDD27 Features"},"Network-Inspector":"\uD83C\uDF10 Network Inspector","Log-Viewer":"\uD83D\uDCDD Log Viewer",Errors:"\uD83D\uDEA8 Errors","Database-Viewer":"\uD83D\uDCBE Database Viewer","Route-Tracker":"\uD83E\uDDED Route Tracker",Timeline:"\uD83E\uDDF5 Timeline","Memory-Viewer":"\uD83D\uDCCA Memory Viewer","FPS-Viewer":"\uD83C\uDFAF FPS Viewer",Alerts:"\uD83D\uDD14 Alerts","--advanced":{type:"separator",title:"\uD83D\uDEE0 Advanced"},Configuration:"⚙️ Configuration","Custom-Database-Provider":"\uD83D\uDD0C Custom Database Provider","--info":{type:"separator",title:"ℹ️ Info"},FAQ:"❓ FAQ"}},{name:"Alerts",route:"/Alerts",frontMatter:{sidebarTitle:"Alerts"}},{name:"Configuration",route:"/Configuration",frontMatter:{sidebarTitle:"Configuration"}},{name:"Custom-Database-Provider",route:"/Custom-Database-Provider",frontMatter:{sidebarTitle:"Custom Database Provider"}},{name:"Database-Viewer",route:"/Database-Viewer",frontMatter:{sidebarTitle:"Database Viewer"}},{name:"Errors",route:"/Errors",frontMatter:{sidebarTitle:"Errors"}},{name:"FAQ",route:"/FAQ",frontMatter:{sidebarTitle:"Faq"}},{name:"FPS-Viewer",route:"/FPS-Viewer",frontMatter:{sidebarTitle:"Fps Viewer"}},{name:"Getting-Started",route:"/Getting-Started",frontMatter:{sidebarTitle:"Getting Started"}},{name:"index",route:"/",frontMatter:{sidebarTitle:"Index"}},{name:"Installation",route:"/Installation",frontMatter:{sidebarTitle:"Installation"}},{name:"Log-Viewer",route:"/Log-Viewer",frontMatter:{sidebarTitle:"Log Viewer"}},{name:"Memory-Viewer",route:"/Memory-Viewer",frontMatter:{sidebarTitle:"Memory Viewer"}},{name:"Network-Inspector",route:"/Network-Inspector",frontMatter:{sidebarTitle:"Network Inspector"}},{name:"Route-Tracker",route:"/Route-Tracker",frontMatter:{sidebarTitle:"Route Tracker"}},{name:"Timeline",route:"/Timeline",frontMatter:{sidebarTitle:"Timeline"}},{name:"Usage",route:"/Usage",frontMatter:{sidebarTitle:"Usage"}}]}},function(e){e.O(0,[812,888,774,179],function(){return e(e.s=9720)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[139],{9720:function(e,i,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/Installation",function(){return t(1220)}])},1220:function(e,i,t){"use strict";t.r(i),t.d(i,{useTOC:function(){return l}});var r=t(5893),n=t(7812),s=t(7080),a=t(8925),d=t(5192);function l(e){return[{value:"From pub.dev (Recommended) / 从 pub.dev 安装(推荐)",id:"from-pubdev-recommended--从-pubdev-安装推荐",depth:2},{value:"From GitHub / 从 GitHub 安装",id:"from-github--从-github-安装",depth:2},{value:"Platform Setup / 平台配置",id:"platform-setup--平台配置",depth:2},{value:"Android",id:"android",depth:3},{value:"iOS",id:"ios",depth:3},{value:"Import / 导入",id:"import--导入",depth:2},{value:"Requirements / 环境要求",id:"requirements--环境要求",depth:2},{value:"Next Steps / 下一步",id:"next-steps--下一步",depth:2}]}i.default=(0,n.c)(function(e){let{toc:i=l(e)}=e,t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",span:"span",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,a.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.h1,{children:"Installation / 安装"}),"\n",(0,r.jsx)(t.h2,{id:i[0].id,children:i[0].value}),"\n",(0,r.jsxs)(t.p,{children:["Add the following to your ",(0,r.jsx)(t.code,{children:"pubspec.yaml"}),":"]}),"\n",(0,r.jsxs)(t.p,{children:["在 ",(0,r.jsx)(t.code,{children:"pubspec.yaml"})," 中添加以下依赖:"]}),"\n",(0,r.jsx)(t.pre,{tabIndex:"0","data-language":"yaml","data-word-wrap":"","data-copy":"",children:(0,r.jsxs)(t.code,{children:[(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:"dependencies"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:":"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" zero_inspector_kit"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": "}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"^1.14.0"})]})]})}),"\n",(0,r.jsx)(t.p,{children:"Then run:"}),"\n",(0,r.jsx)(t.p,{children:"然后运行:"}),"\n",(0,r.jsx)(t.pre,{icon:d.Fx,tabIndex:"0","data-language":"bash","data-word-wrap":"","data-copy":"",children:(0,r.jsx)(t.code,{children:(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#6F42C1","--shiki-dark":"#B392F0"},children:"flutter"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" pub"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" get"})]})})}),"\n",(0,r.jsx)(t.h2,{id:i[1].id,children:i[1].value}),"\n",(0,r.jsx)(t.p,{children:"Alternatively, install from GitHub:"}),"\n",(0,r.jsx)(t.p,{children:"或者从 GitHub 安装:"}),"\n",(0,r.jsx)(t.pre,{tabIndex:"0","data-language":"yaml","data-word-wrap":"","data-copy":"",children:(0,r.jsxs)(t.code,{children:[(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:"dependencies"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:":"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" zero_inspector_kit"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:":"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" git"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:":"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" url"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": "}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"https://github.com/zero-labsco/zero_inspector_kit.git"})]}),"\n",(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#22863A","--shiki-dark":"#85E89D"},children:" ref"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:": "}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:"release/v1.14.0"})]})]})}),"\n",(0,r.jsx)(t.h2,{id:i[2].id,children:i[2].value}),"\n",(0,r.jsx)(t.h3,{id:i[3].id,children:i[3].value}),"\n",(0,r.jsx)(t.p,{children:"No additional configuration needed."}),"\n",(0,r.jsx)(t.p,{children:"无需额外配置。"}),"\n",(0,r.jsx)(t.h3,{id:i[4].id,children:i[4].value}),"\n",(0,r.jsx)(t.p,{children:"No additional configuration needed."}),"\n",(0,r.jsx)(t.p,{children:"无需额外配置。"}),"\n",(0,r.jsx)(t.h2,{id:i[5].id,children:i[5].value}),"\n",(0,r.jsx)(t.pre,{tabIndex:"0","data-language":"dart","data-word-wrap":"","data-copy":"",children:(0,r.jsx)(t.code,{children:(0,r.jsxs)(t.span,{children:[(0,r.jsx)(t.span,{style:{"--shiki-light":"#D73A49","--shiki-dark":"#F97583"},children:"import"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#032F62","--shiki-dark":"#9ECBFF"},children:" 'package:zero_inspector_kit/zero_inspector_kit.dart'"}),(0,r.jsx)(t.span,{style:{"--shiki-light":"#24292E","--shiki-dark":"#E1E4E8"},children:";"})]})})}),"\n",(0,r.jsx)(t.h2,{id:i[6].id,children:i[6].value}),"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n",(0,r.jsxs)(t.table,{children:[(0,r.jsx)(t.thead,{children:(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.th,{children:"Requirement"}),(0,r.jsx)(t.th,{children:"Version"})]})}),(0,r.jsxs)(t.tbody,{children:[(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"Flutter"}),(0,r.jsx)(t.td,{children:">= 3.3.0"})]}),(0,r.jsxs)(t.tr,{children:[(0,r.jsx)(t.td,{children:"Dart SDK"}),(0,r.jsx)(t.td,{children:">= 3.11.0 < 4.0.0"})]})]})]}),"\n",(0,r.jsx)(t.h2,{id:i[7].id,children:i[7].value}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.a,{href:"Getting-Started",children:"Getting Started"})," — Quick start guide / 快速开始"]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.a,{href:"Usage",children:"Usage"})," — Full usage guide / 完整使用指南"]}),"\n"]})]})},"/Installation",{filePath:"pages/Installation.md",timestamp:178793305e4,pageMap:s.v,frontMatter:{},title:"Installation / 安装"},"undefined"==typeof RemoteContent?l:RemoteContent.useTOC)},7080:function(e,i,t){"use strict";t.d(i,{v:function(){return r}});let r=[{data:{index:"\uD83C\uDFE0 Home","Getting-Started":"\uD83D\uDE80 Getting Started",Installation:"\uD83D\uDCE6 Installation",Usage:"\uD83D\uDCD6 Usage","--features":{type:"separator",title:"\uD83D\uDD27 Features"},"Network-Inspector":"\uD83C\uDF10 Network Inspector","Log-Viewer":"\uD83D\uDCDD Log Viewer",Errors:"\uD83D\uDEA8 Errors","Database-Viewer":"\uD83D\uDCBE Database Viewer","Route-Tracker":"\uD83E\uDDED Route Tracker",Timeline:"\uD83E\uDDF5 Timeline","Memory-Viewer":"\uD83D\uDCCA Memory Viewer","FPS-Viewer":"\uD83C\uDFAF FPS Viewer",Alerts:"\uD83D\uDD14 Alerts","--advanced":{type:"separator",title:"\uD83D\uDEE0 Advanced"},Configuration:"⚙️ Configuration","Custom-Database-Provider":"\uD83D\uDD0C Custom Database Provider","--info":{type:"separator",title:"ℹ️ Info"},FAQ:"❓ FAQ"}},{name:"Alerts",route:"/Alerts",frontMatter:{sidebarTitle:"Alerts"}},{name:"Configuration",route:"/Configuration",frontMatter:{sidebarTitle:"Configuration"}},{name:"Custom-Database-Provider",route:"/Custom-Database-Provider",frontMatter:{sidebarTitle:"Custom Database Provider"}},{name:"Database-Viewer",route:"/Database-Viewer",frontMatter:{sidebarTitle:"Database Viewer"}},{name:"Errors",route:"/Errors",frontMatter:{sidebarTitle:"Errors"}},{name:"FAQ",route:"/FAQ",frontMatter:{sidebarTitle:"Faq"}},{name:"FPS-Viewer",route:"/FPS-Viewer",frontMatter:{sidebarTitle:"Fps Viewer"}},{name:"Getting-Started",route:"/Getting-Started",frontMatter:{sidebarTitle:"Getting Started"}},{name:"index",route:"/",frontMatter:{sidebarTitle:"Index"}},{name:"Installation",route:"/Installation",frontMatter:{sidebarTitle:"Installation"}},{name:"Log-Viewer",route:"/Log-Viewer",frontMatter:{sidebarTitle:"Log Viewer"}},{name:"Memory-Viewer",route:"/Memory-Viewer",frontMatter:{sidebarTitle:"Memory Viewer"}},{name:"Network-Inspector",route:"/Network-Inspector",frontMatter:{sidebarTitle:"Network Inspector"}},{name:"Route-Tracker",route:"/Route-Tracker",frontMatter:{sidebarTitle:"Route Tracker"}},{name:"Timeline",route:"/Timeline",frontMatter:{sidebarTitle:"Timeline"}},{name:"Usage",route:"/Usage",frontMatter:{sidebarTitle:"Usage"}}]}},function(e){e.O(0,[812,888,774,179],function(){return e(e.s=9720)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 6ee01de..502c734 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,4 +1,4 @@ -
    🏠 Home

    Zero Inspector Kit

    +
    🏠 Home

    Zero Inspector Kit

    A powerful Flutter plugin for in-app developer console, providing real-time debugging tools including network request inspection, logging, error aggregation, database viewing, and route tracking.

    一个功能强大的 Flutter 插件,提供应用内开发者控制台,包括网络请求检查、日志记录、异常聚合、数据库查看和路由追踪。

    ✨ Features / 功能特性

    @@ -149,4 +149,4 @@

    This project is licensed under the GNU General Public License v3.0.

    本项目采用 GNU General Public License v3.0 许可证。

    This plugin is provided “as is”, without warranty of any kind. The author assumes no responsibility or liability for the functionality, security, or any consequences arising from the use of modified versions or derivative projects.

    -

    本插件按”原样”提供,不提供任何担保。作者不对修改版或衍生项目的功能、安全性及任何使用后果承担责任。


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file +

    本插件按”原样”提供,不提供任何担保。作者不对修改版或衍生项目的功能、安全性及任何使用后果承担责任。


    Zero Inspector Kit · MPL-2.0
    \ No newline at end of file diff --git a/ios/zero_inspector_kit.podspec b/ios/zero_inspector_kit.podspec index 9556b14..807b734 100644 --- a/ios/zero_inspector_kit.podspec +++ b/ios/zero_inspector_kit.podspec @@ -4,7 +4,7 @@ # Pod::Spec.new do |s| s.name = 'zero_inspector_kit' - s.version = '1.13.0' + s.version = '1.14.0' s.summary = 'An in-app developer console for Flutter: network, logs, database, memory, FPS, errors, alerts and routes.' s.description = <<-DESC An in-app developer console for Flutter that inspects HTTP/Dio traffic, WebSocket and gRPC streams, logs, databases, memory and FPS (with build/raster split), aggregates and persists errors and alerts, tracks routes, and exports a shareable session archive - all auto-disabled in release builds. diff --git a/lib/src/interceptors/dio_interceptor.dart b/lib/src/interceptors/dio_interceptor.dart index 28929a1..c54b372 100644 --- a/lib/src/interceptors/dio_interceptor.dart +++ b/lib/src/interceptors/dio_interceptor.dart @@ -1,3 +1,5 @@ +import 'dart:async'; +import 'dart:convert'; import 'dart:math'; import '../models/network_request.dart'; @@ -95,7 +97,7 @@ class InspectorDioInterceptor extends InspectorDioInterceptorBase { final request = _findRequestByIdOrUrl(requestId, requestUrl); InspectorService.instance.updateNetworkRequest( request.id, - responseBody: response['data'], + responseBody: _previewBody(response['data']), statusCode: response['statusCode'] as int?, ); } @@ -107,13 +109,56 @@ class InspectorDioInterceptor extends InspectorDioInterceptorBase { final requestId = _extractRequestId(error['requestOptions']); final requestUrl = error['requestOptions']?['uri']?.toString() ?? ''; final request = _findRequestByIdOrUrl(requestId, requestUrl); + // 无 HTTP 响应(超时 / 网络错误等):response 为 null,statusCode 用 -1 占位, + // 否则 updateNetworkRequest 只在 statusCode != null 时才写耗时,请求会永挂“进行中”。 + // No HTTP response (timeout / network error): `response` is null, so use -1 as + // a placeholder; otherwise a request would hang "in progress" forever. + final statusCode = error['response']?['statusCode'] as int?; InspectorService.instance.updateNetworkRequest( request.id, - responseBody: error['response']?['data'] ?? error['message'], - statusCode: error['response']?['statusCode'] as int?, + responseBody: _previewBody( + error['response']?['data'] ?? error['message'], + ), + statusCode: statusCode ?? -1, ); } + /// 把 Dio 的 `data` 转成可安全存入 body 的值,规避两类问题: + /// - `responseType: stream` 时 data 是 ResponseBody(单次可读流):既不读取也不 + /// close 会泄漏底层 socket,且 `toString()` 只会变成 "Instance of 'ResponseBody'"。 + /// 这里按 run-time 特征识别(持有 `stream` 成员、且非字符串/Map/List),异步排空 + /// 流以释放底层连接,body 记为 null(面板显示无 body)。本文件刻意不依赖 dio 包, + /// 故不引用 [ResponseBody] 类型,改用动态特征判断。 + /// - `responseType: bytes` 时 data 是原始字节列表,直接持有会常驻内存且 `toString()` + /// 巨大;按预览上限截断后存 base64 字符串。 + /// Convert Dio `data` into a value safe to store as the body, avoiding two issues: + /// a stream ResponseBody (socket leak + useless toString) and unbounded byte lists. + /// This file deliberately does not depend on the `dio` package, so we detect the + /// stream case by its runtime shape (a `stream` member that is a Stream) instead of + /// referencing the `ResponseBody` type. + dynamic _previewBody(dynamic data) { + if (data != null && data is! String && data is! Map && data is! List) { + // 可能是 ResponseBody:尝试读取 .stream 是否为 Stream,是则排空后记为 null。 + // Possibly a ResponseBody: try to read `.stream`; drain it and record null. + try { + final s = data.stream; + if (s is Stream) { + unawaited(s.listen((_) {}).asFuture().catchError((_) {})); + return null; + } + } catch (_) { + // 没有 .stream 成员,按普通对象处理。 + // No `.stream` member; treat as a normal object. + } + } + if (data is List) { + final cap = InspectorService.instance.maxBodyPreviewBytes; + final bytes = data.length > cap ? data.sublist(0, cap) : data; + return base64Encode(bytes); + } + return data; + } + /// 从 requestOptions 中提取 request ID / Extract request ID from requestOptions String? _extractRequestId(dynamic requestOptions) { if (requestOptions is Map) { diff --git a/lib/src/interceptors/inspector_http_client.dart b/lib/src/interceptors/inspector_http_client.dart index 8cedd90..8aa1bd0 100644 --- a/lib/src/interceptors/inspector_http_client.dart +++ b/lib/src/interceptors/inspector_http_client.dart @@ -16,14 +16,27 @@ class _InspectorHttpClient implements HttpClient { int port, String path, ) { - // 非标 https 端口(如 8443)也按 https 记录,仅影响展示 URL。 - final scheme = (port == 443 || port == 8443) ? 'https' : 'http'; + // 仅当调用方直接使用 `HttpClient.open(...)`(不带 scheme 信息)时才需要猜测。 + // 常规 `getUrl` 走 openUrl,已带正确 scheme。常见非标 TLS 端口(如 8443/7443/ + // 9443)也按 https 处理,避免把 https 请求错记成 http(并避免对 TLS 端口发起 + // 明文连接)。这是 best-effort:任意 TLS 端口无法仅凭端口判断。 + // Only guessed when the caller uses `HttpClient.open(...)` directly (no scheme). + // The normal `getUrl` path goes through openUrl with the correct scheme. Common + // non-standard TLS ports (8443/7443/9443) are treated as https so we don't + // mislabel https as http (or open a plaintext socket to a TLS port). + final scheme = _isTlsPort(port) ? 'https' : 'http'; return openUrl( method, Uri(scheme: scheme, host: host, port: port, path: path), ); } + /// 常见 TLS 端口集合(best-effort 判定 https)。/ Common TLS ports (best-effort). + static const Set _tlsPorts = {443, 8443, 7443, 9443, 8444, 9444}; + + /// 仅凭端口 best-effort 判断是否为 https。/ Best-effort https detection by port. + static bool _isTlsPort(int port) => _tlsPorts.contains(port); + static const String _dioRequestIdHeader = 'x-inspector-request-id'; /// 加密随机源 / Cryptographic random source @@ -627,7 +640,7 @@ class _InspectorRequestProxy implements HttpClientRequest { _request.abort(exception, stackTrace); @override - HttpConnectionInfo? get connectionInfo => null; + HttpConnectionInfo? get connectionInfo => _request.connectionInfo; @override List get cookies => _request.cookies; diff --git a/lib/src/interceptors/inspector_response_proxy.dart b/lib/src/interceptors/inspector_response_proxy.dart index 841f6c0..1d97ab7 100644 --- a/lib/src/interceptors/inspector_response_proxy.dart +++ b/lib/src/interceptors/inspector_response_proxy.dart @@ -144,7 +144,18 @@ class _InspectorResponseProxy implements HttpClientResponse { String get reasonPhrase => _response.reasonPhrase; @override - HttpHeaders get headers => _response.headers; + HttpHeaders get headers { + final rule = _getRule(); + // 命中响应头修改规则时,把规则里的响应头叠加到底层 headers 上返回, + // 让业务方实际读到被修改后的响应头(此前 responseHeaders 被定义却从未生效)。 + // When a response-header rule matches, overlay the rule's headers on top of the + // underlying headers so the consumer sees the modified response (previously + // `responseHeaders` was defined but never applied). + if (rule?.responseHeaders != null && rule!.responseHeaders!.isNotEmpty) { + return _MergedHttpHeaders(_response.headers, rule.responseHeaders!); + } + return _response.headers; + } @override int get contentLength { @@ -154,6 +165,15 @@ class _InspectorResponseProxy implements HttpClientResponse { final bodyStr = body is String ? body : jsonEncode(body); return utf8.encode(bodyStr).length; } + // gzip 等自动解压后,_response.contentLength 是压缩前(线上)长度,与业务方实际 + // 读到的解压字节数不一致;流消费完成后转发解压后的真实字节数,避免面板显示的 + // 长度与 body 对不上。 + // After auto-decompression, _response.contentLength is the pre-compression (wire) + // length and mismatches the decompressed bytes the consumer actually reads; once + // the stream is consumed, report the real decompressed length. + if (compressionState == HttpClientResponseCompressionState.compressed) { + return _bodyCaptured ? _bodyBytes.length : _response.contentLength; + } return _response.contentLength; } @@ -416,3 +436,116 @@ class _InspectorResponseProxy implements HttpClientResponse { @override Stream cast() => _wrappedStream.cast(); } + +/// 叠加了拦截规则响应头的 [HttpHeaders] 视图。 +/// 仅在存在 `responseHeaders` 规则时构造,叠加层覆盖底层同名头、并补充底层没有的键。 +/// 写入方法直接委托给底层(规则只影响“展示给业务方的响应头”,不改写真实响应)。 +/// A [HttpHeaders] view that overlays interceptor-rule response headers. Built only +/// when a `responseHeaders` rule exists; the overlay replaces same-named headers and +/// adds keys missing from the base. Writes delegate to the base (rules only affect +/// the headers the consumer observes, never the real response). +class _MergedHttpHeaders implements HttpHeaders { + final HttpHeaders _inner; + final Map _overlay; + + _MergedHttpHeaders(this._inner, this._overlay); + + String? _overlayValue(String name) { + for (final k in _overlay.keys) { + if (k.toLowerCase() == name.toLowerCase()) return _overlay[k]; + } + return null; + } + + List? _merged(String name) { + final o = _overlayValue(name); + if (o != null) return [o]; + return _inner[name]; + } + + @override + String? value(String name) => _overlayValue(name) ?? _inner.value(name); + + @override + List? operator [](String name) => _merged(name); + + @override + void forEach(void Function(String name, List values) action) { + final emitted = {}; + _inner.forEach((name, values) { + emitted.add(name.toLowerCase()); + action(name, _merged(name) ?? values); + }); + for (final e in _overlay.entries) { + if (!emitted.contains(e.key.toLowerCase())) action(e.key, [e.value]); + } + } + + @override + void add(String name, Object value, {bool preserveHeaderCase = false}) => + _inner.add(name, value, preserveHeaderCase: preserveHeaderCase); + @override + void set(String name, Object value, {bool preserveHeaderCase = false}) => + _inner.set(name, value, preserveHeaderCase: preserveHeaderCase); + @override + void remove(String name, Object value) => _inner.remove(name, value); + @override + void removeAll(String name) => _inner.removeAll(name); + @override + void clear() => _inner.clear(); + @override + void noFolding(String name) => _inner.noFolding(name); + + @override + DateTime? get date => _parseDate(value(HttpHeaders.dateHeader)); + @override + set date(DateTime? value) => _inner.date = value; + @override + DateTime? get expires => _parseDate(value(HttpHeaders.expiresHeader)); + @override + set expires(DateTime? value) => _inner.expires = value; + @override + DateTime? get ifModifiedSince => + _parseDate(value(HttpHeaders.ifModifiedSinceHeader)); + @override + set ifModifiedSince(DateTime? value) => _inner.ifModifiedSince = value; + @override + String? get host => value(HttpHeaders.hostHeader); + @override + set host(String? value) => _inner.host = value; + @override + int? get port => int.tryParse(value('port') ?? ''); + @override + set port(int? value) => _inner.port = value; + @override + ContentType? get contentType { + final v = value(HttpHeaders.contentTypeHeader); + return v == null ? null : ContentType.parse(v); + } + + @override + set contentType(ContentType? value) => _inner.contentType = value; + @override + bool get chunkedTransferEncoding => value('transfer-encoding') == 'chunked'; + @override + set chunkedTransferEncoding(bool value) => + _inner.chunkedTransferEncoding = value; + @override + bool get persistentConnection => value('connection') == 'keep-alive'; + @override + set persistentConnection(bool value) => _inner.persistentConnection = value; + + @override + int get contentLength => _inner.contentLength; + @override + set contentLength(int value) => _inner.contentLength = value; + + static DateTime? _parseDate(String? value) { + if (value == null) return null; + try { + return HttpDate.parse(value); + } catch (_) { + return null; + } + } +} diff --git a/lib/src/interceptors/log_interceptor.dart b/lib/src/interceptors/log_interceptor.dart index f00045a..88a15be 100644 --- a/lib/src/interceptors/log_interceptor.dart +++ b/lib/src/interceptors/log_interceptor.dart @@ -133,11 +133,14 @@ class InspectorLogInterceptor { } /// 恢复原始的 FlutterError.onError / Restore original FlutterError.onError + /// + /// 即使原始值为 null 也要恢复回去——此前只在非 null 时恢复,导致原本没有注册 + /// 自定义 onError 的宿主在 stop 后,检查器的回调仍常驻(且拿不到 Flutter 默认的 + /// 错误呈现)。/ Even when the original was null we must restore it; otherwise a + /// host with no custom handler keeps our callback alive after stop. void _restoreFlutterOnError() { - if (_originalFlutterOnError != null) { - FlutterError.onError = _originalFlutterOnError!; - _originalFlutterOnError = null; - } + FlutterError.onError = _originalFlutterOnError; + _originalFlutterOnError = null; } /// 捕获日志并添加到服务中 / Capture log and add to service diff --git a/lib/src/interceptors/route_observer.dart b/lib/src/interceptors/route_observer.dart index 4c8965a..85ff3e4 100644 --- a/lib/src/interceptors/route_observer.dart +++ b/lib/src/interceptors/route_observer.dart @@ -62,9 +62,14 @@ class InspectorRouteObserver extends RouteObserver> { } } + /// 全局自增序号,避免同一毫秒内 didPush + didReplace 生成相同 id 导致碰撞。 + /// A global auto-increment counter so didPush + didReplace within the same + /// millisecond can never collide on an id. + static int _seq = 0; + /// 生成唯一路由记录ID / Generate unique route record ID String _generateId() { - return 'route_${DateTime.now().millisecondsSinceEpoch}'; + return 'route_${_seq++}'; } } diff --git a/lib/src/models/network_request.dart b/lib/src/models/network_request.dart index 32b48a2..c0fac4d 100644 --- a/lib/src/models/network_request.dart +++ b/lib/src/models/network_request.dart @@ -173,13 +173,28 @@ class NetworkRequest { ); } - /// 将 [value] 截断为不超过 [maxBytes] 字符的头部预览;超长时附截断提示。 - /// Truncate [value] to a head preview no longer than [maxBytes] chars; append a note when clipped. + /// 将 [value] 截断为不超过 [maxBytes] **字节**(UTF-8)的头部预览;超长时附截断提示。 + /// 此前按 UTF-16 字符数截断,中文 / gzip base64 场景下会低估约 2-3 倍预算,导致 + /// body 实际比上限长很多。现在按真实字节数截断,与全局 body 预算的单位一致。 + /// Truncate [value] to a head preview no longer than [maxBytes] **UTF-8 bytes**. + /// Previously it counted UTF-16 chars, underestimating the budget ~2-3x for CJK / + /// gzip base64; now it matches the global body budget's unit (bytes). static dynamic _truncate(dynamic value, int maxBytes) { if (value == null) return value; final str = value.toString(); - if (str.length <= maxBytes) return str; - return '${str.substring(0, maxBytes)}\n' - '[… truncated ${str.length - maxBytes} chars …]'; + final bytes = utf8.encode(str); + if (bytes.length <= maxBytes) return str; + // 按字节截断后再解码为合法字符串,避免截断在字符中途产生乱码。 + // Truncate by bytes, then decode back to a valid string (no mid-codeunit split). + var end = maxBytes; + while (end > 0) { + try { + final slice = utf8.decode(bytes.sublist(0, end)); + return '$slice\n[… truncated ${bytes.length - end} bytes …]'; + } on FormatException { + end--; + } + } + return '[… truncated ${bytes.length} bytes …]'; } } diff --git a/lib/src/services/alert_service.dart b/lib/src/services/alert_service.dart index a940087..a72c0e1 100644 --- a/lib/src/services/alert_service.dart +++ b/lib/src/services/alert_service.dart @@ -121,13 +121,13 @@ class AlertService { for (final rule in _rules) { if (!rule.enabled || rule.kind != AlertKind.httpStatus) continue; if (r.statusCode != null && r.statusCode! >= rule.threshold) { - _fire(r.url, 'HTTP ${r.statusCode} ${r.method}'); + _fire(r.url, 'HTTP ${r.statusCode} ${r.method}', throttleKey: rule.id); } } for (final rule in _rules) { if (!rule.enabled || rule.kind != AlertKind.requestDuration) continue; if (r.duration != null && r.duration! >= rule.threshold) { - _fire(r.url, 'Slow ${r.duration}ms ${r.method}'); + _fire(r.url, 'Slow ${r.duration}ms ${r.method}', throttleKey: rule.id); } } } @@ -138,7 +138,11 @@ class AlertService { if (!rule.enabled || rule.kind != AlertKind.logLevel) continue; // ERROR=4, WTF=5 / LogLevel ordinal if (e.level.index >= rule.threshold) { - _fire(e.tag ?? 'log', '${e.level.name}: ${e.message}'); + _fire( + e.tag ?? 'log', + '${e.level.name}: ${e.message}', + throttleKey: rule.id, + ); } } } @@ -148,7 +152,11 @@ class AlertService { for (final rule in _rules) { if (!rule.enabled || rule.kind != AlertKind.memoryMb) continue; if (mb >= rule.threshold) { - _fire('memory', '${mb.toStringAsFixed(0)} MB used'); + _fire( + 'memory', + '${mb.toStringAsFixed(0)} MB used', + throttleKey: rule.id, + ); } } } @@ -158,20 +166,29 @@ class AlertService { for (final rule in _rules) { if (!rule.enabled || rule.kind != AlertKind.fpsLow) continue; if (fps > 0 && fps < rule.threshold) { - _fire('fps', 'FPS dropped to ${fps.toStringAsFixed(0)}'); + _fire( + 'fps', + 'FPS dropped to ${fps.toStringAsFixed(0)}', + throttleKey: rule.id, + ); } } } /// 触发一条告警:入队并累加未读 / Fire an alert: enqueue and bump unread /// - /// 同 (source, message) 在 [_perSourceCooldownMs] 毫秒内重复触发会被节流, + /// 同 (source, [throttleKey]) 在 [_perSourceCooldownMs] 毫秒内重复触发会被节流, /// 避免高频检查(如 500ms 内存/FPS 轮询、慢请求循环)淹没告警缓冲。 - /// Repeated firings for the same (source, message) within - /// [_perSourceCooldownMs] are throttled to avoid alert storms. - void _fire(String source, String message) { + /// 注意:[throttleKey] 取**规则级稳定标识**(如 `rule.id`),不要包含随时间 + /// 波动的数值(内存 MB、耗时 ms 等)——此前 key 直接用了含数值的 [message], + /// 数值一变 key 就变,1s 冷却完全失效,内存页每个轮询 tick 都产生新告警。 + /// Repeated firings for the same (source, [throttleKey]) within + /// [_perSourceCooldownMs] are throttled. [throttleKey] must be a stable + /// per-rule identity, not the volatile [message] (which embeds MB / ms), or the + /// cooldown never holds. + void _fire(String source, String message, {String? throttleKey}) { final now = DateTime.now().millisecondsSinceEpoch; - final key = (source, message); + final key = (source, throttleKey ?? message); final last = _lastFiredAt[key]; if (last != null && now - last < _perSourceCooldownMs) { return; diff --git a/lib/src/services/fps_service.dart b/lib/src/services/fps_service.dart index 085514f..bc03a36 100644 --- a/lib/src/services/fps_service.dart +++ b/lib/src/services/fps_service.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:collection'; import 'dart:ui' show FramePhase; import 'package:flutter/scheduler.dart'; @@ -107,7 +108,10 @@ class FpsService extends ChangeNotifier { double _currentFps = 0; /// 最近帧耗时列表 / Recent frame duration list - final List _frameRecords = []; + /// 用 [ListQueue] 替代 List:每帧从头部淘汰旧记录是 O(1)(原 List.removeRange 是 O(n))。 + /// Uses [ListQueue] instead of List: dropping old records from the head is O(1) + /// (the previous List.removeRange was O(n) per frame). + final ListQueue _frameRecords = ListQueue(); /// 最近一秒内的帧时间戳 / Frame timestamps in the most recent second final List _recentFrameTimestamps = []; @@ -271,9 +275,9 @@ class FpsService extends ChangeNotifier { _recentFrameTimestamps.add(frameStartUs); } - // 限制历史记录数量 / Limit history size - if (_frameRecords.length > _maxFrameRecords) { - _frameRecords.removeRange(0, _frameRecords.length - _maxFrameRecords); + // 限制历史记录数量:从头部淘汰最旧的,O(1) 每次 / Cap history: drop oldest from head, O(1) each + while (_frameRecords.length > _maxFrameRecords) { + _frameRecords.removeFirst(); } } diff --git a/lib/src/services/inspector_service.dart b/lib/src/services/inspector_service.dart index 2cf8e61..67a9187 100644 --- a/lib/src/services/inspector_service.dart +++ b/lib/src/services/inspector_service.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:collection'; +import 'dart:convert'; import 'package:flutter/foundation.dart'; import 'package:flutter/scheduler.dart'; @@ -54,11 +55,10 @@ class ThrottledNotifier extends ChangeNotifier { binding.scheduleFrame(); binding.addPostFrameCallback((_) => doNotify()); } catch (_) { - // 无绑定可用:退回 Timer 兜底。 - // No binding available: fall back to a Timer. + // 无绑定可用:退回一次性 Timer 兜底(触发后自动回收,不会常驻)。 + // No binding available: fall back to a one-shot Timer (auto-reclaimed). Timer(const Duration(milliseconds: 16), doNotify); } - Timer(const Duration(milliseconds: 500), doNotify); } /// 重置帧排程标志(dispose 时调用)/ Reset the frame-scheduling flag (on dispose) @@ -161,11 +161,16 @@ class InspectorService { ? 0 : _maxGlobalBodyBytes - _globalBodyBytes; - /// 估算一条请求的 body 字节占用(字符数近似)/ Estimate a request's buffered body bytes (char-count approximation) + /// 估算一条请求的 body 字节占用(UTF-8 字节,与全局预算单位一致)。 + /// Estimate a request's buffered body bytes (UTF-8, consistent with the budget unit). + /// 此前用字符串长度(UTF-16 码元)近似,中文 / gzip base64 会低估约 2-3 倍。 + /// Previously used string length (UTF-16 code units), underestimating ~2-3x for CJK. static int _bodyBytesOf(NetworkRequest r) { var n = 0; - if (r.body != null) n += r.body.toString().length; - if (r.responseBody != null) n += r.responseBody.toString().length; + if (r.body != null) n += utf8.encode(r.body.toString()).length; + if (r.responseBody != null) { + n += utf8.encode(r.responseBody.toString()).length; + } return n; } @@ -341,8 +346,10 @@ class InspectorService { // would be too expensive to write every time. if (statusCode != null) { PersistenceService.instance.enqueueNetwork(updated); + // 告警检查同样只在响应真正到达时进行;进行中的请求(statusCode 为 null) + // 每帧都跑 checkNetwork 纯属浪费。/ Alert check only on real arrival too. + AlertService.instance.checkNetwork(updated); } - AlertService.instance.checkNetwork(updated); networkNotifier.notifyThrottled(); } diff --git a/lib/src/services/memory_inspector_service.dart b/lib/src/services/memory_inspector_service.dart index c7a346d..8548477 100644 --- a/lib/src/services/memory_inspector_service.dart +++ b/lib/src/services/memory_inspector_service.dart @@ -152,6 +152,12 @@ class MemoryInspectorService extends ChangeNotifier { /// 存储统计刷新定时器 / Storage stats refresh timer Timer? _storageTimer; + /// 存储统计重入守卫:_refreshStorageStats 会整树递归统计,耗时较长,3s 定时器可能在 + /// 上一次未完成时再次触发,导致多份全量遍历并发。加锁后跳过重叠的触发。 + /// Re-entrancy guard for storage stats: _refreshStorageStats walks the whole tree + /// and can be slow, so the 3s timer may overlap a previous run. Skip overlapping runs. + bool _storageStatsRunning = false; + /// 泄漏检测检查定时器 / Leak detection check timer Timer? _leakDetectionTimer; @@ -170,6 +176,12 @@ class MemoryInspectorService extends ChangeNotifier { /// 长连接的订阅 / Subscription backing the persistent socket StreamSubscription? _vmServiceSocketSub; + /// 正在进行中的建连任务:并发调用 [_ensureVmServiceSocket] 时复用同一结果, + /// 避免两个调用各建一个 WebSocket,先建的订阅被覆盖后永不 close(泄漏)。 + /// In-flight connect task: concurrent [_ensureVmServiceSocket] calls share one + /// result, so two calls never open two WebSockets (leaking the first handle). + Future? _connectingSocket; + /// 在途 RPC 调用(按 JSON-RPC id 索引)/ In-flight RPCs keyed by JSON-RPC id final Map>> _pendingVmRpc = {}; @@ -184,6 +196,12 @@ class MemoryInspectorService extends ChangeNotifier { /// Contains records in all four states: tracking, verifying, leaked, released final Map _trackedRecords = {}; + /// 内存刷新重入守卫:[_refreshMemoryData] 最长阻塞 3s(WebSocket 超时)/2s(HTTP), + /// 慢网络下会重叠多次重入,导致并发请求堆积、快照重复注入、RSS 彼此覆盖。 + /// Re-entrancy guard for memory refresh: [_refreshMemoryData] can block up to 3s, + /// so on slow networks several calls overlap and stack up; this prevents it. + bool _refreshing = false; + /// 获取所有泄漏检测记录的只读快照 / Get read-only snapshot of all leak detection records List get leakRecords => _trackedRecords.values.toList(); @@ -656,35 +674,45 @@ class MemoryInspectorService extends ChangeNotifier { /// 同时合并最近一次 Native 内存数据到快照 /// Also merges last Native memory data into snapshot Future _refreshMemoryData() async { - // 1. 始终采集进程 RSS(来自 ProcessInfo,无需网络) - // 1. Always collect process RSS (from ProcessInfo, no network required) - // 注:Native 定时器(3 秒)会用更准确的 RSS 覆盖此值 - // Note: Native timer (3s) will overwrite this with more accurate RSS + // 重入守卫:_fetchDartHeapData 最长阻塞 3s(WebSocket 超时)/2s(HTTP), + // 慢网络下 Timer 会重叠调用本函数,导致并发请求堆积、快照重复注入、RSS 互相覆盖。 + // Re-entrancy guard: _fetchDartHeapData can block up to 3s, so the timer would + // otherwise overlap calls and stack concurrent requests / duplicate snapshots. + if (_refreshing) return; + _refreshing = true; try { - _currentProcessRss = ProcessInfo.currentRss; - } catch (_) {} + // 1. 始终采集进程 RSS(来自 ProcessInfo,无需网络) + // 1. Always collect process RSS (from ProcessInfo, no network required) + // 注:Native 定时器(3 秒)会用更准确的 RSS 覆盖此值 + // Note: Native timer (3s) will overwrite this with more accurate RSS + try { + _currentProcessRss = ProcessInfo.currentRss; + } catch (_) {} - // 2. 如果 VM Service 已可用,则采集 Dart Heap 数据 - // 2. If VM Service is available, collect Dart Heap data - if (_vmServiceAvailable && _vmServiceHttpUri != null) { - await _fetchDartHeapData(); - } + // 2. 如果 VM Service 已可用,则采集 Dart Heap 数据 + // 2. If VM Service is available, collect Dart Heap data + if (_vmServiceAvailable && _vmServiceHttpUri != null) { + await _fetchDartHeapData(); + } - // 3. 创建并保存快照(合并 Native + Dart Heap 数据) - // 3. Create and save snapshot (merging Native + Dart Heap data) - final snapshot = _buildSnapshot(); - _memorySnapshots.add(snapshot); + // 3. 创建并保存快照(合并 Native + Dart Heap 数据) + // 3. Create and save snapshot (merging Native + Dart Heap data) + final snapshot = _buildSnapshot(); + _memorySnapshots.add(snapshot); - // 4. 限制历史快照数量,移除最旧的数据 - // 4. Limit snapshot count, remove oldest data - while (_memorySnapshots.length > _maxSnapshots) { - _memorySnapshots.removeAt(0); - } + // 4. 限制历史快照数量,移除最旧的数据 + // 4. Limit snapshot count, remove oldest data + while (_memorySnapshots.length > _maxSnapshots) { + _memorySnapshots.removeAt(0); + } - // 告警检测:以进程 RSS(MB)为准 / Alert: use process RSS in MB - AlertService.instance.checkMemory(_currentProcessRss / (1024 * 1024)); + // 告警检测:以进程 RSS(MB)为准 / Alert: use process RSS in MB + AlertService.instance.checkMemory(_currentProcessRss / (1024 * 1024)); - _liveNotifier.notifyListeners(); + _liveNotifier.notifyListeners(); + } finally { + _refreshing = false; + } } /// 构建当前内存快照 / Build current memory snapshot @@ -1027,6 +1055,22 @@ class MemoryInspectorService extends ChangeNotifier { Future _ensureVmServiceSocket() async { final existing = _vmServiceSocket; if (existing != null && existing.closeCode == null) return existing; + // 并发防重入:已有建连在跑则复用其 Future,避免两个调用各开一个 WebSocket。 + // Concurrency guard: reuse the in-flight connect instead of opening a second one. + if (_connectingSocket != null) return _connectingSocket!; + final future = _doConnectVmServiceSocket(); + _connectingSocket = future; + try { + return await future; + } finally { + // 无论成功失败都清空,失败后可重试。 + // Clear on every path so a failed connect can be retried. + _connectingSocket = null; + } + } + + /// 实际建立 VM Service WebSocket 连接 / Actually establish the VM Service socket + Future _doConnectVmServiceSocket() async { await _closeVmServiceSocket(); final uri = _vmServiceWsUri; @@ -1317,6 +1361,8 @@ class MemoryInspectorService extends ChangeNotifier { /// 刷新存储统计数据 / Refresh storage statistics data Future _refreshStorageStats() async { + if (_storageStatsRunning) return; + _storageStatsRunning = true; try { final results = await Future.wait([ getDocumentsDirSize(), @@ -1327,7 +1373,12 @@ class MemoryInspectorService extends ChangeNotifier { _cachedCacheSize = results[1]; _cachedDatabaseSize = results[2]; notifyListeners(); - } catch (_) {} + } catch (_) { + // 保留上一次成功的结果,避免统计失败时 UI 抖动为 0。 + // Keep the last successful result so a failed refresh doesn't reset the UI to 0. + } finally { + _storageStatsRunning = false; + } } /// 获取所有数据库文件总大小(字节)/ Get total database file size (bytes) @@ -1440,6 +1491,10 @@ class MemoryInspectorService extends ChangeNotifier { final releaseAfter = expectedReleaseAfter ?? _defaultExpectedReleaseAfter; final record = LeakRecord( + // 对外“追踪 ID”沿用 identityHashCode(与公开 API 契约及既有测试保持一致), + // 同对象重复 track 时 key 相同从而覆盖旧记录;不同对象 hash 碰撞属极罕见边界。 + // The public "tracking id" stays identityHashCode to keep the API contract and + // existing tests stable; re-tracking the same object overwrites via the same key. objectId: identityHashCode(object), objectType: object.runtimeType.toString(), weakRef: WeakReference(object), @@ -1464,10 +1519,23 @@ class MemoryInspectorService extends ChangeNotifier { /// [objectIdOrObject] 可以是对象本身或对象的 hashCode(trackObject 返回值) /// Can be the object itself or object's hashCode (return value of trackObject) void untrackObject(Object objectIdOrObject) { - final id = objectIdOrObject is int - ? objectIdOrObject - : identityHashCode(objectIdOrObject); - final removed = _trackedRecords.remove(id); + int? id; + if (objectIdOrObject is int) { + id = objectIdOrObject; + } else { + // 传入对象本身:用 identical 匹配弱引用持有的对象。不能用 identityHashCode + // 反查——它不再唯一,会误删另一条记录。 + // Object passed: match via identical on the weak-referenced target. Do NOT + // use identityHashCode (no longer unique) or it would remove the wrong record. + for (final r in _trackedRecords.values) { + final target = r.weakRef.target; + if (target != null && identical(target, objectIdOrObject)) { + id = r.objectId; + break; + } + } + } + final removed = id != null ? _trackedRecords.remove(id) : null; if (removed != null) { notifyListeners(); } @@ -1589,11 +1657,12 @@ class MemoryInspectorService extends ChangeNotifier { unawaited(triggerGc()); } - // 超过最大数量时,清理最旧的已释放记录 - // When exceeding max count, clean up oldest released records + // 超过最大数量时,清理最旧的记录(按优先级级联淘汰) + // When exceeding max count, evict oldest records (cascading by priority) if (_trackedRecords.length > _maxTrackedRecords) { + final before = _trackedRecords.length; _trimExcessRecords(); - changed = true; + if (_trackedRecords.length < before) changed = true; } if (changed) { @@ -1601,26 +1670,61 @@ class MemoryInspectorService extends ChangeNotifier { } } - /// 清理超出数量的已释放记录 / Clean up released records exceeding quantity limit + /// 清理超出数量的记录 / Clean up records exceeding the quantity limit /// - /// 优先保留 leaked、verifying、tracking 状态的记录 - /// Prioritize keeping leaked, verifying, tracking state records - /// 仅在总数超过 [_maxTrackedRecords] 时,移除最旧的 released 记录 - /// Only remove oldest released records when total exceeds [_maxTrackedRecords] + /// 此前只删 released,导致 verifying / tracking / leaked 永不淘汰、无界增长 + /// (release / 真机无 VM Service 时 verifying 记录尤其会堆积)。 + /// 现在按优先级 leaked > verifying > tracking > released 逐档淘汰最旧者, + /// 直到回到 [_maxTrackedRecords] 以内;leaked 最后才动,尽量保留已确认泄漏。 + /// Previously only `released` was evicted, so verifying / tracking / leaked grew + /// unbounded (verifying especially piles up on release / real-device without VM + /// Service). Now evict by priority leaked > verifying > tracking > released, + /// oldest first, until back under [_maxTrackedRecords]; leaked is touched last. void _trimExcessRecords() { if (_trackedRecords.length <= _maxTrackedRecords) return; - // 提取已释放记录,按 trackedAt 从旧到新排序 - // Extract released records, sorted by trackedAt from oldest to newest - final releasedRecords = - _trackedRecords.values - .where((r) => r.status == LeakStatus.released) - .toList() - ..sort((a, b) => a.trackedAt.compareTo(b.trackedAt)); + List oldestFirst(List list) => + (list..sort((a, b) => a.trackedAt.compareTo(b.trackedAt))); + + final released = oldestFirst( + _trackedRecords.values + .where((r) => r.status == LeakStatus.released) + .toList(), + ); + final verifying = oldestFirst( + _trackedRecords.values + .where((r) => r.status == LeakStatus.verifying) + .toList(), + ); + final tracking = oldestFirst( + _trackedRecords.values + .where((r) => r.status == LeakStatus.tracking) + .toList(), + ); + final leaked = oldestFirst( + _trackedRecords.values + .where((r) => r.status == LeakStatus.leaked) + .toList(), + ); int needRemove = _trackedRecords.length - _maxTrackedRecords; - for (final r in releasedRecords) { - if (needRemove <= 0) break; + for (final r in released) { + if (needRemove <= 0) return; + _trackedRecords.remove(r.objectId); + needRemove--; + } + for (final r in verifying) { + if (needRemove <= 0) return; + _trackedRecords.remove(r.objectId); + needRemove--; + } + for (final r in tracking) { + if (needRemove <= 0) return; + _trackedRecords.remove(r.objectId); + needRemove--; + } + for (final r in leaked) { + if (needRemove <= 0) return; _trackedRecords.remove(r.objectId); needRemove--; } diff --git a/lib/src/services/persistence_service.dart b/lib/src/services/persistence_service.dart index c0c1a2c..f21f5d3 100644 --- a/lib/src/services/persistence_service.dart +++ b/lib/src/services/persistence_service.dart @@ -54,6 +54,13 @@ class PersistenceService { Database? _db; bool _enabled = false; + + /// 正在进行的 init 任务;用于并发防重入,避免两次 init 各 openDatabase + /// 导致前一个句柄泄漏。失败时置 null 以便 barrel 的重试循环再次尝试。 + /// In-flight init task: prevents two concurrent `init`s from each opening a + /// database (leaking the first handle). Reset to null on failure so the host's + /// retry loop can try again once the binding is ready. + Completer? _initFuture; int _maxRows = _defaultMaxRows; Duration _retention = _defaultRetention; Timer? _flushTimer; @@ -78,6 +85,12 @@ class PersistenceService { Duration flushInterval = _defaultFlushInterval, }) async { if (_enabled) return; + // 并发防重入:已有 init 在跑则直接复用其结果,避免两个调用各 openDatabase + // 导致前一个句柄泄漏。 + // Concurrency guard: reuse the in-flight init instead of opening a second DB. + if (_initFuture != null) return _initFuture!.future; + final c = Completer(); + _initFuture = c; _maxRows = maxRowsPerTable; _retention = retention; try { @@ -122,12 +135,18 @@ class PersistenceService { _flushTimer?.cancel(); _flushTimer = Timer.periodic(flushInterval, (_) => flush()); await _trim(); + c.complete(); } catch (_) { // 桌面端未配置 sqflite FFI 等情况:降级为纯内存模式。 // e.g. desktop without sqflite FFI: fall back to memory-only mode. _enabled = false; _db = null; + // 失败后允许重试(binding 就绪后再调 init 能重新打开)。 + // Allow a later retry after failure (e.g. once the binding is ready). + _initFuture = null; + c.complete(); } + return c.future; } /// 建索引:裁剪每 2s 跑 6 条 `NOT IN (SELECT id ... ORDER BY id DESC LIMIT n)` @@ -453,5 +472,6 @@ class PersistenceService { } catch (_) {} _db = null; _enabled = false; + _initFuture = null; } } diff --git a/lib/src/services/ws_inspector_service.dart b/lib/src/services/ws_inspector_service.dart index e5fbc80..cb5ff12 100644 --- a/lib/src/services/ws_inspector_service.dart +++ b/lib/src/services/ws_inspector_service.dart @@ -68,6 +68,14 @@ class WsInspectorService extends ChangeNotifier { /// 活跃会话表(sessionId -> 会话)/ Active sessions (sessionId -> session) final Map _sessions = {}; + /// 会话 body 同步到 InspectorService 的节流时间戳:每帧都 `updateNetworkRequest` + /// 会把整串 body 复制 + 重新统计字节(O(n²)),故按 10Hz 限频;关闭时由 `_onClose` + /// 兜底同步最终 body。 + /// Throttle timestamp for syncing session body to InspectorService: calling + /// `updateNetworkRequest` every frame copies the whole body + re-counts bytes + /// (O(n²)), so we cap it at ~10Hz; `_onClose` syncs the final body regardless. + int _lastBodySyncAt = 0; + /// 同时保留的会话数上限(按插入顺序淘汰最旧)/ Max concurrent sessions (oldest evicted) static const int _maxSessions = 20; @@ -135,16 +143,28 @@ class WsInspectorService extends ChangeNotifier { // Accumulate into the network record's responseBody for the detail view & export (back-compat). final arrow = outgoing ? '→' : '←'; session.appendBody('$arrow $text\n'); - InspectorService.instance.updateNetworkRequest( - id, - responseBody: session.bodyBuffer.toString(), - ); + // 10Hz 限频同步 body(见 [_lastBodySyncAt]);关闭时由 _onClose 兜底同步最终值。 + // Sync the body at ~10Hz (see [_lastBodySyncAt]); the final value is synced by + // _onClose on close. + final nowMs = DateTime.now().millisecondsSinceEpoch; + if (nowMs - _lastBodySyncAt >= 100) { + _lastBodySyncAt = nowMs; + InspectorService.instance.updateNetworkRequest( + id, + responseBody: session.bodyBuffer.toString(), + ); + } } /// 连接关闭:追加关闭标记帧 / Connection closed: append a close marker frame void _onClose(String id) { final session = _sessions[id]; if (session == null) return; + // 幂等:close() 与底层流 onDone 都会触发,重复触发会再追加一条关闭帧并以 + // statusCode:101 覆盖记录。已关闭则直接返回。 + // Idempotent: both `close()` and the inner stream's `onDone` call this, so a + // duplicate would append another close frame and overwrite statusCode with 101. + if (session.closed) return; session.closed = true; session.addFrame( WsFrame( diff --git a/lib/src/utils/environment.dart b/lib/src/utils/environment.dart index 1918cfd..6ad4eef 100644 --- a/lib/src/utils/environment.dart +++ b/lib/src/utils/environment.dart @@ -7,11 +7,19 @@ class InspectorEnvironment { /// 是否为生产环境 / Whether in production environment /// 通过编译参数 --dart-define=INSPECTOR_ENABLED=false 控制 / Controlled by compile parameter --dart-define=INSPECTOR_ENABLED=false + /// + /// 未指定时沿用各模式默认(release/profile 关闭、debug 开启);显式指定时仅 + /// `false`(任意大小写)关闭,其余视作开启。此前用 [bool.fromEnvironment], + /// 无法区分“未设置”与“显式 false”,导致 debug 下 `--dart-define=...=false` + /// 永远被后续 `return true` 覆盖而失效。 + /// When unspecified, follows the per-mode default (off in release/profile, on in + /// debug). When explicitly set, only `false` (any case) disables it; anything + /// else enables. The previous [bool.fromEnvironment] could not tell "unset" from + /// "explicit false", so `--dart-define=...=false` in debug was always overridden. static bool get isInspectorEnabled { - final enabled = bool.fromEnvironment('INSPECTOR_ENABLED'); - if (enabled) return true; - if (!kDebugMode) return false; - return true; + final raw = String.fromEnvironment('INSPECTOR_ENABLED'); + if (raw.isEmpty) return kDebugMode; + return raw.toLowerCase() != 'false'; } /// 是否为调试模式 / Whether in debug mode diff --git a/lib/src/utils/inspector_version.dart b/lib/src/utils/inspector_version.dart index e5742c3..aff27f1 100644 --- a/lib/src/utils/inspector_version.dart +++ b/lib/src/utils/inspector_version.dart @@ -12,5 +12,5 @@ class InspectorVersion { /// 当前版本号,必须与 `pubspec.yaml` 的 `version` 字段一致 /// Current version; must match the `version` field in `pubspec.yaml` - static const String value = '1.13.0'; + static const String value = '1.14.0'; } diff --git a/lib/src/utils/sensitive_data.dart b/lib/src/utils/sensitive_data.dart index 947aca8..cbf725f 100644 --- a/lib/src/utils/sensitive_data.dart +++ b/lib/src/utils/sensitive_data.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + /// 敏感数据脱敏 / Sensitive data masking /// /// 集中处理导出 / 复制 / 分享前的脱敏,覆盖三个此前完全没覆盖的泄漏面: @@ -186,8 +188,11 @@ class SensitiveData { ); /// `Bearer ` 形式的凭据 / `Bearer ` credentials + /// 字符集包含 `:`,避免 `Bearer aaa:bbb` 仅前缀被掩而尾部泄漏。 + /// The charset includes `:` so `Bearer aaa:bbb` is masked fully, not just the + /// prefix. static final RegExp _bearer = RegExp( - r'(Bearer\s+)[A-Za-z0-9\-._~+/=]+', + r'(Bearer\s+)[A-Za-z0-9\-._~+/=:]+', caseSensitive: false, ); @@ -196,47 +201,99 @@ class SensitiveData { r'\bey[A-Za-z0-9_-]{6,}\.[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]{4,}', ); + /// PII:中国大陆手机号(11 位,1[3-9] 开头)/ PII: mainland China mobile number + static final RegExp _phone = RegExp(r'1[3-9]\d{9}'); + + /// PII:中国大陆身份证号(18 位,末位可为 X)/ PII: mainland China ID card + static final RegExp _idCard = RegExp(r'(? '${m.group(1)}$placeholder'); - out = out.replaceAllMapped(_jwt, (_) => placeholder); - return out; + final decoded = jsonDecode(body); + final masked = _maskJsonValue(decoded); + return jsonEncode(masked); } catch (_) { - return body; + try { + var out = body.replaceAllMapped(_jsonPair, (m) { + final key = _decodeJsonKey(m.group(1)!); + if (!isSensitiveKey(key)) return m.group(0)!; + final value = m.group(3)!; + // 字符串值替换为带引号的占位符,其余字面量直接替换,保持 JSON 合法。 + // Quote the placeholder for string values, replace literals as-is, so + // the result stays valid JSON. + final maskedValue = value.startsWith('"') ? '"$placeholder"' : 'null'; + return '${m.group(1)}${m.group(2)}$maskedValue'; + }); + out = _applyTokenAndPii(out); + return out; + } catch (_) { + // 兜底:保守脱敏,绝不原样回退。 + // Fallback: conservative masking, never fail-open. + return placeholder; + } } } - /// 对任意文本做兜底脱敏(Bearer / JWT),用于非 JSON 内容 - /// Best-effort masking (Bearer / JWT) for non-JSON content + /// 解码 JSON key(含 `\uXXXX` 转义)/ Decode a JSON key (handles `\uXXXX` escapes) + static String _decodeJsonKey(String rawKey) { + try { + return jsonDecode(rawKey) as String; + } catch (_) { + return rawKey.substring(1, rawKey.length - 1); + } + } + + /// 递归脱敏一个已解码的 JSON 值 / Recursively mask a decoded JSON value + static dynamic _maskJsonValue(dynamic value) { + if (value is Map) { + return value.map((k, v) { + final key = k is String ? k : k.toString(); + // 敏感键:无论值是标量、对象还是数组,一律脱敏为 null(保持合法 JSON)。 + // Sensitive key: mask the value to null regardless of scalar / object / + // array, keeping the result valid JSON. + if (isSensitiveKey(key)) return MapEntry(k, null); + return MapEntry(k, _maskJsonValue(v)); + }); + } else if (value is List) { + return value.map(_maskJsonValue).toList(); + } + return value; + } + + /// 同时应用 Bearer / JWT / 手机号 / 身份证 脱敏 / Apply Bearer / JWT / phone / ID masking + static String _applyTokenAndPii(String text) { + var out = text.replaceAllMapped( + _bearer, + (m) => '${m.group(1)}$placeholder', + ); + out = out.replaceAllMapped(_jwt, (_) => placeholder); + out = out.replaceAll(_phone, placeholder); + out = out.replaceAll(_idCard, placeholder); + return out; + } + + /// 对任意文本做兜底脱敏(Bearer / JWT / PII),用于非 JSON 内容 + /// Best-effort masking (Bearer / JWT / PII) for non-JSON content static String maskText(String text) { if (text.isEmpty) return text; try { - var out = text.replaceAllMapped( - _bearer, - (m) => '${m.group(1)}$placeholder', - ); - out = out.replaceAllMapped(_jwt, (_) => placeholder); - return out; + return _applyTokenAndPii(text); } catch (_) { - return text; + // 兜底:保守脱敏,绝不原样回退。 + // Fallback: conservative masking, never fail-open. + return placeholder; } } diff --git a/pubspec.yaml b/pubspec.yaml index 0ba217d..6812051 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: zero_inspector_kit description: One-line in-app developer console for Flutter — HTTP/WebSocket/gRPC inspection, logs, database, memory leaks, FPS jank, routes, alerts, bug reports. Auto-disabled in release. -version: 1.13.0 +version: 1.14.0 topics: - logging - debug From 80cc8efc1afb4dbcf727118a6a03fc700207cf0e Mon Sep 17 00:00:00 2001 From: AmisKwok Date: Wed, 30 Sep 2026 08:51:19 +0800 Subject: [PATCH 2/5] docs: make CHANGELOG bilingual EN-primary and codify format in AGENTS.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reformat the 1.14.0 section as English top-level bullets with Chinese nested sub-bullets (no slash separator), and document the EN-primary/ZH-secondary convention in AGENTS.md so future releases stay consistent. 将 CHANGELOG 1.14.0 段落改为英文主条目 + 中文嵌套子条目(不使用斜杠分隔),并在 AGENTS.md 中固化英中双语格式约定,确保后续发版一致。 --- AGENTS.md | 7 +++++++ CHANGELOG.md | 36 ++++++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d452c43..1ff80c9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -108,6 +108,13 @@ Notes / 说明: - [ ] `README_zh.md`: same spots as `README.md` (`^X.Y.Z`, `` `X.Y.Z` `` placeholder, `ref: release/vX.Y.Z`, and the "🔔 推荐升级:" callout). The callout should briefly summarize what the current release changed and recommend the latest version; it must not reference previous versions. - [ ] `website/pages/*.md`: the install snippet uses the `__ZIK_VERSION__` placeholder; it is auto-filled from `pubspec.yaml` by `website/scripts/sync-docs.mjs`, so bumping `pubspec.yaml` alone is enough (do NOT hardcode a version there). - [ ] `CHANGELOG.md`: add a new `## X.Y.Z` section at the top describing the changes. + - **CHANGELOG bilingual format / 变更日志双语格式:** Every entry MUST be bilingual English-primary, Chinese-secondary (EN-primary, ZH-secondary). Do NOT use a ` / ` slash to separate the two languages — it is too easy to miss. Use a nested sub-bullet instead: the English description is the top-level bullet, and the Chinese translation is an indented nested bullet directly beneath it, with **no** explicit "中文:" / "EN:" label. Section headers stay bilingual as `### Fixed / 修复`, `### Changed / 优化`, `### Added / 新增`. Example: + ```markdown + ### Fixed / 修复 + - Fixed several memory-leak tracking issues: `_trackedRecords` now evicts oldest entries by priority `leaked > verifying > tracking > released` ... + - 修复内存泄漏追踪的若干隐患:`_trackedRecords` 改为按优先级 `leaked > verifying > tracking > released` ... + ``` + / 每条变更必须英中双语(英文为主、中文为辅,EN-primary, ZH-secondary)。不要用 ` / ` 斜杠分隔中英文(太不显眼)。改用嵌套子条目:英文描述作为一级条目,中文翻译缩进为其下方子条目,且**不要**加"中文:" / "EN:" 这类显式标签。小节标题保持 `### Fixed / 修复`、`### Changed / 优化`、`### Added / 新增` 形式。 - **Changelog scope rule / 变更日志范围规则:** Only changes to `lib/` (i.e. published-package runtime behavior) earn a CHANGELOG entry. Pure documentation updates (`README*.md`, `website/`, `docs/`) and `example/` changes must NOT get a CHANGELOG entry — they do not change the released package's runtime behavior. The single exception is a **pure version-bump commit**: bumping the version legitimately updates the CHANGELOG (and the doc version strings) as part of cutting the release, which is allowed. / 只有 `lib/` 的改动(即已发布包的运行行为)才进 CHANGELOG;纯文档(`README*.md`、`website/`、`docs/`)与 `example/` 的改动不应写进 CHANGELOG——它们不改变发布包的运行行为。唯一的例外是「单纯 bump 版本」的提交:为发版而更新 CHANGELOG(及文档版本号)是允许的。 - Grep sanity check before committing: `grep -rn "old_version" README.md README_zh.md website/pages` must return NOTHING (only legitimate historical prose may remain; the `__ZIK_VERSION__` placeholder is expected and is not a real version). **Website (Nextra docs site):** `website/` is built and synced to `docs/` automatically by the `pre-commit` hook (`website/scripts/sync-docs.mjs`). Version references in `website/pages/*.md` use the `__ZIK_VERSION__` placeholder, which is filled from `pubspec.yaml` at build time — bumping `pubspec.yaml` propagates to the site automatically. Never edit `docs/` by hand; it is regenerated on every commit that touches `website/`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 449ba13..7bea161 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,20 +3,32 @@ ## 1.14.0 ### Fixed / 修复 -- 修复内存泄漏追踪的若干隐患:`_trackedRecords` 改为按优先级 `leaked > verifying > tracking > released` 级联淘汰最旧者,封住此前仅删 `released`、其余状态无界增长的内存风险(release / 真机无 VM Service 时 `verifying` 记录尤其会堆积);VM Service WebSocket 增加“连接中”并发保护避免重复建连泄漏;内存刷新增加重入守卫。追踪 ID 仍沿用 `identityHashCode` 以兼容公开 API 与既有测试。 / Fixed several memory-leak tracking issues: `_trackedRecords` now evicts oldest entries by priority `leaked > verifying > tracking > released`, closing the previous unbounded-growth hole where only `released` was trimmed (verifying records piled up especially on release / real-device without VM Service); guarded the VM Service WebSocket against concurrent reconnect leaks; added a reentrancy guard to the memory refresh. The tracking id stays `identityHashCode` to keep the public API and existing tests stable. -- 修复资源泄漏:`InspectorService.notifyThrottled` 的兜底 Timer 改为可取消(避免瞬时堆积大量 Timer);`WsInspectorService` 重复 `close` 去重;`LogInterceptor` 在 `FlutterError.onError` 原本为 null 时正确恢复。 / Fixed resource leaks: made the throttle fallback `Timer` cancelable (avoids transient piles of timers); de-duplicated `WsInspectorService` double-close; restored `FlutterError.onError` to null when it was originally null. -- 修复 `AlertService` 节流 key 含易变数值导致 1s 冷却失效的问题(key 改为 `source + rule.id`)。 / Fixed `AlertService` throttle key containing volatile numbers that defeated the 1s cooldown (key is now `source + rule.id`). -- 修复 `PersistenceService.init` 并发穿透导致重复 `openDatabase`(旧句柄泄漏),改用 `_initFuture` 串行化。 / Fixed `PersistenceService.init` concurrent re-entry opening two databases (leaking the old handle) by serializing via `_initFuture`. -- 修复 Dio 抓包:无响应(超时/网络错)时以 `statusCode: -1` 占位避免请求永挂“进行中”;`responseType: stream` 不再持有未关闭的 `ResponseBody`(socket 泄漏),`bytes` 时按预览上限截断。 / Fixed Dio capture: a timeout/no-response now gets a `statusCode: -1` placeholder instead of hanging forever; `responseType: stream` no longer holds an unclosed `ResponseBody` (socket leak), and `bytes` is truncated to the preview cap. -- 修复路由 id 用毫秒时间戳会碰撞(`didPush`+`didReplace` 同毫秒),改用全局自增计数器。 / Fixed route id collisions from millisecond timestamps by switching to a global auto-increment counter. -- 修复拦截规则“修改响应头”静默不生效(`responseHeaders` 仅定义未应用);HTTP client 仅按 `443/8443` 猜 scheme 会误判其它 TLS 端口为 http,并转发真实的 `connectionInfo`。 / Fixed interceptor rules' response-header rewrite being silently ignored; the HTTP client now infers scheme beyond just `443/8443` and forwards the real `connectionInfo`. -- 修复 `inspector_response_proxy` gzip 解压后 `contentLength` 仍以压缩前长度下发导致面板字节数偏差。 / Fixed `contentLength` after gzip decompression still reporting the pre-compression length. -- 修复 `environment.isInspectorEnabled` 在 debug 下 `--dart-define=INSPECTOR_ENABLED=false` 失效(改用 `String.fromEnvironment` 区分“未设置 vs false”)。 / Fixed `environment.isInspectorEnabled` ignoring `--dart-define=INSPECTOR_ENABLED=false` in debug by using `String.fromEnvironment`. +- Fixed several memory-leak tracking issues: `_trackedRecords` now evicts oldest entries by priority `leaked > verifying > tracking > released`, closing the previous unbounded-growth hole where only `released` was trimmed (verifying records piled up especially on release / real-device without VM Service); guarded the VM Service WebSocket against concurrent reconnect leaks; added a reentrancy guard to the memory refresh. The tracking id stays `identityHashCode` to keep the public API and existing tests stable. + - 修复内存泄漏追踪的若干隐患:`_trackedRecords` 改为按优先级 `leaked > verifying > tracking > released` 级联淘汰最旧者,封住此前仅删 `released`、其余状态无界增长的内存风险(release / 真机无 VM Service 时 `verifying` 记录尤其会堆积);VM Service WebSocket 增加"连接中"并发保护避免重复建连泄漏;内存刷新增加重入守卫。追踪 ID 仍沿用 `identityHashCode` 以兼容公开 API 与既有测试。 +- Fixed resource leaks: made the throttle fallback `Timer` cancelable (avoids transient piles of timers); de-duplicated `WsInspectorService` double-close; restored `FlutterError.onError` to null when it was originally null. + - 修复资源泄漏:`InspectorService.notifyThrottled` 的兜底 Timer 改为可取消(避免瞬时堆积大量 Timer);`WsInspectorService` 重复 `close` 去重;`LogInterceptor` 在 `FlutterError.onError` 原本为 null 时正确恢复。 +- Fixed `AlertService` throttle key containing volatile numbers that defeated the 1s cooldown (key is now `source + rule.id`). + - 修复 `AlertService` 节流 key 含易变数值导致 1s 冷却失效的问题(key 改为 `source + rule.id`)。 +- Fixed `PersistenceService.init` concurrent re-entry opening two databases (leaking the old handle) by serializing via `_initFuture`. + - 修复 `PersistenceService.init` 并发穿透导致重复 `openDatabase`(旧句柄泄漏),改用 `_initFuture` 串行化。 +- Fixed Dio capture: a timeout/no-response now gets a `statusCode: -1` placeholder instead of hanging forever; `responseType: stream` no longer holds an unclosed `ResponseBody` (socket leak), and `bytes` is truncated to the preview cap. + - 修复 Dio 抓包:无响应(超时/网络错)时以 `statusCode: -1` 占位避免请求永挂"进行中";`responseType: stream` 不再持有未关闭的 `ResponseBody`(socket 泄漏),`bytes` 时按预览上限截断。 +- Fixed route id collisions from millisecond timestamps by switching to a global auto-increment counter. + - 修复路由 id 用毫秒时间戳会碰撞(`didPush`+`didReplace` 同毫秒),改用全局自增计数器。 +- Fixed interceptor rules' response-header rewrite being silently ignored; the HTTP client now infers scheme beyond just `443/8443` and forwards the real `connectionInfo`. + - 修复拦截规则"修改响应头"静默不生效(`responseHeaders` 仅定义未应用);HTTP client 仅按 `443/8443` 猜 scheme 会误判其它 TLS 端口为 http,并转发真实的 `connectionInfo`。 +- Fixed `contentLength` after gzip decompression still reporting the pre-compression length. + - 修复 `inspector_response_proxy` gzip 解压后 `contentLength` 仍以压缩前长度下发导致面板字节数偏差。 +- Fixed `environment.isInspectorEnabled` ignoring `--dart-define=INSPECTOR_ENABLED=false` in debug by using `String.fromEnvironment`. + - 修复 `environment.isInspectorEnabled` 在 debug 下 `--dart-define=INSPECTOR_ENABLED=false` 失效(改用 `String.fromEnvironment` 区分"未设置 vs false")。 ### Changed / 优化 -- 敏感数据脱敏加固:失败不再原样回退(fail-open)而是保守脱敏;支持 JSON key 的 Unicode 转义(`\u0077` 等)反转义后匹配;敏感键值为对象/数组时也递归脱敏;Bearer 正则覆盖 `:` 等字符;新增手机号/身份证号 PII 正则。 / Hardened sensitive-data masking: no longer falls back to the original body on error; supports Unicode-unescaped JSON keys; recurses into object/array values; widens the Bearer regex; adds phone/ID PII patterns. -- 性能:FPS 帧列表改用 `ListQueue` 消除每帧 O(n) 搬移;WS 会话 body 汇总降频到 10Hz;存储统计增加防重入。 / Perf: FPS frame list uses `ListQueue` to remove per-frame O(n) shifts; WS session body aggregation is throttled to 10Hz; storage stats gained re-entrancy protection. -- `InspectorService.maxBodyPreviewBytes` 单位由“UTF-16 字符”改为真实字节,避免中文 / gzip base64 场景低估约 2-3 倍预算。 / `InspectorService.maxBodyPreviewBytes` now counts real bytes instead of UTF-16 chars, avoiding ~2-3x under-budgeting for CJK / gzip base64. +- Hardened sensitive-data masking: no longer falls back to the original body on error; supports Unicode-unescaped JSON keys; recurses into object/array values; widens the Bearer regex; adds phone/ID PII patterns. + - 敏感数据脱敏加固:失败不再原样回退(fail-open)而是保守脱敏;支持 JSON key 的 Unicode 转义(`\u0077` 等)反转义后匹配;敏感键值为对象/数组时也递归脱敏;Bearer 正则覆盖 `:` 等字符;新增手机号/身份证号 PII 正则。 +- Perf: FPS frame list uses `ListQueue` to remove per-frame O(n) shifts; WS session body aggregation is throttled to 10Hz; storage stats gained re-entrancy protection. + - 性能:FPS 帧列表改用 `ListQueue` 消除每帧 O(n) 搬移;WS 会话 body 汇总降频到 10Hz;存储统计增加防重入。 +- `InspectorService.maxBodyPreviewBytes` now counts real bytes instead of UTF-16 chars, avoiding ~2-3x under-budgeting for CJK / gzip base64. + - `InspectorService.maxBodyPreviewBytes` 单位由"UTF-16 字符"改为真实字节,避免中文 / gzip base64 场景低估约 2-3 倍预算。 ## 1.13.0 From 9dd949c9f305fafdf5fccc894770da72abce2616 Mon Sep 17 00:00:00 2001 From: AmisKwok Date: Wed, 30 Sep 2026 09:06:12 +0800 Subject: [PATCH 3/5] fix: fix WS frame text color and Switch accent in inspector UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WebSocket frame body text now uses InspectorColors.textPrimary instead of default black on the dark card; the Auto-scroll and Request Matching switches use the mint-green accent (InspectorColors.accent) for thumb and track instead of the default purple Material theme. Documented under CHANGELOG 1.14.0. 网络详情页 WebSocket 帧正文改用 textPrimary(不再黑底黑字);自动滚动与 Request Matching 开关改用项目薄荷绿 accent(不再默认紫色)。已记入 1.14.0 变更日志。 --- CHANGELOG.md | 4 ++++ lib/src/ui/network_viewer.dart | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bea161..9e90bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,10 @@ - 修复 `inspector_response_proxy` gzip 解压后 `contentLength` 仍以压缩前长度下发导致面板字节数偏差。 - Fixed `environment.isInspectorEnabled` ignoring `--dart-define=INSPECTOR_ENABLED=false` in debug by using `String.fromEnvironment`. - 修复 `environment.isInspectorEnabled` 在 debug 下 `--dart-define=INSPECTOR_ENABLED=false` 失效(改用 `String.fromEnvironment` 区分"未设置 vs false")。 +- Fixed WebSocket frame body text in the network detail view rendering in default black on the dark card background (illegible); it now uses `InspectorColors.textPrimary`. + - 修复网络详情页 WebSocket 帧正文在深色卡片背景上以默认黑色渲染、看不清的问题,现改用 `InspectorColors.textPrimary`。 +- Fixed `Switch` controls (WebSocket auto-scroll toggle and interceptor rule "Request Matching") using the default purple Material theme instead of the project's mint-green accent; they now use `InspectorColors.accent` for both thumb and track. + - 修复开关控件(WebSocket 自动滚动开关、拦截规则"Request Matching"开关)使用默认紫色 Material 主题而非项目薄荷绿的问题,现 thumbs/track 均使用 `InspectorColors.accent`。 ### Changed / 优化 - Hardened sensitive-data masking: no longer falls back to the original body on error; supports Unicode-unescaped JSON keys; recurses into object/array values; widens the Bearer regex; adds phone/ID PII patterns. diff --git a/lib/src/ui/network_viewer.dart b/lib/src/ui/network_viewer.dart index 687b994..ecdc6a2 100644 --- a/lib/src/ui/network_viewer.dart +++ b/lib/src/ui/network_viewer.dart @@ -131,6 +131,10 @@ class _WsFramesViewState extends State<_WsFramesView> { Switch( value: _autoScroll, onChanged: (v) => setState(() => _autoScroll = v), + activeColor: InspectorColors.accent, + activeTrackColor: InspectorColors.accent.withValues(alpha: 0.5), + inactiveThumbColor: InspectorColors.textSecondary, + inactiveTrackColor: InspectorColors.border, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), ], @@ -206,7 +210,11 @@ class _WsFramesViewState extends State<_WsFramesView> { const SizedBox(height: 2), Text( f.text, - style: const TextStyle(fontSize: 11, fontFamily: 'monospace'), + style: TextStyle( + fontSize: 11, + fontFamily: 'monospace', + color: InspectorColors.textPrimary, + ), maxLines: 4, overflow: TextOverflow.ellipsis, ), @@ -1918,7 +1926,10 @@ class _InterceptorRulePanelState extends State { value: _rule.enabled, onChanged: (value) => _updateRule(_rule.copyWith(enabled: value)), - activeThumbColor: InspectorColors.accent, + activeColor: InspectorColors.accent, + activeTrackColor: InspectorColors.accent.withValues(alpha: 0.5), + inactiveThumbColor: InspectorColors.textSecondary, + inactiveTrackColor: InspectorColors.border, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, ), Text( From 02e2134458ce9a68ae82736d112135197df8e612 Mon Sep 17 00:00:00 2001 From: AmisKwok Date: Wed, 30 Sep 2026 09:12:16 +0800 Subject: [PATCH 4/5] fix: replace deprecated Switch.activeColor with activeThumbColor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The WS auto-scroll and Request Matching switches used the deprecated Switch.activeColor; switched to activeThumbColor (track already uses activeTrackColor) so flutter analyze reports no issues. WS 自动滚动与 Request Matching 开关改用已废弃的 activeColor,改为 activeThumbColor(track 仍用 activeTrackColor),消除 flutter analyze 的废弃告警。 --- lib/src/ui/network_viewer.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/ui/network_viewer.dart b/lib/src/ui/network_viewer.dart index ecdc6a2..d23b419 100644 --- a/lib/src/ui/network_viewer.dart +++ b/lib/src/ui/network_viewer.dart @@ -131,7 +131,7 @@ class _WsFramesViewState extends State<_WsFramesView> { Switch( value: _autoScroll, onChanged: (v) => setState(() => _autoScroll = v), - activeColor: InspectorColors.accent, + activeThumbColor: InspectorColors.accent, activeTrackColor: InspectorColors.accent.withValues(alpha: 0.5), inactiveThumbColor: InspectorColors.textSecondary, inactiveTrackColor: InspectorColors.border, @@ -1926,7 +1926,7 @@ class _InterceptorRulePanelState extends State { value: _rule.enabled, onChanged: (value) => _updateRule(_rule.copyWith(enabled: value)), - activeColor: InspectorColors.accent, + activeThumbColor: InspectorColors.accent, activeTrackColor: InspectorColors.accent.withValues(alpha: 0.5), inactiveThumbColor: InspectorColors.textSecondary, inactiveTrackColor: InspectorColors.border, From 5567c2063c2b1db37f0b37ea2b471efe30ad4924 Mon Sep 17 00:00:00 2001 From: AmisKwok Date: Wed, 30 Sep 2026 09:13:27 +0800 Subject: [PATCH 5/5] chore: sync example/pubspec.lock to 1.14.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The example app depends on the plugin via path; after the version bump to 1.14.0, lutter pub get in example/ refreshed the locked plugin version from 1.13.0 to 1.14.0. 示例工程以 path 方式依赖本插件,版本 bump 到 1.14.0 后,example 重新解析依赖把锁文件中的插件版本从 1.13.0 同步为 1.14.0。 --- example/pubspec.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index df2919a..44de111 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -738,7 +738,7 @@ packages: path: ".." relative: true source: path - version: "1.13.0" + version: "1.14.0" sdks: dart: ">=3.11.0 <4.0.0" flutter: ">=3.38.4"