Skip to content

Releases: zero-labsco/zero_inspector_kit

Release v1.2.2

Choose a tag to compare

@github-actions github-actions released this 03 Aug 17:00
8586df9

🔔 推荐升级 / Upgrade recommended: 本版本修复了拦截器的若干健壮性问题(大响应体 OOM、第三方错误上报被覆盖、并发同 URL 请求错乱),并修复了 example 依赖无法解析的问题。
This release fixes several interceptor robustness issues (large-response OOM, overwritten third-party error reporting, concurrent same-URL request mis-association) and an unresolvable example dependency.

本版本提升了拦截器在与网络请求、错误捕获交互时的健壮性,并修正了 example 工程的可解析性。
This release improves interceptor robustness for network requests and error capture, and fixes the example project's resolvability.

修复 / Bug Fixes:

  • 拦截器健壮性修复 / Interceptor robustness fixes
    • HTTP 拦截器:捕获的响应体上限设为 512KB,避免下载大文件时内存溢出(OOM)
    • HTTP interceptor: cap captured response body at 512KB to avoid OOM on large downloads
    • 日志拦截器:保留并恢复原始的 FlutterError.onError,不再覆盖 Crashlytics / Sentry 等第三方错误上报
    • Log interceptor: preserve and restore the original FlutterError.onError so third-party reporters (Crashlytics/Sentry) are no longer overwritten
    • Dio 拦截器:响应/错误匹配优先使用 x-inspector-request-id,回退到 URL,避免并发同 URL 请求错乱配对
    • Dio interceptor: match responses/errors by x-inspector-request-id first, falling back to URL, to avoid mis-associating concurrent same-URL requests
  • 构建修复 / Build fix
    • example 的 dio 依赖由不存在的 5.11.0 固定为 5.4.0,修复 flutter pub get 解析失败
    • Pinned example dio from the non-existent 5.11.0 to 5.4.0, fixing flutter pub get resolution failure

Release v1.2.1

Choose a tag to compare

@github-actions github-actions released this 30 Jul 06:08

修复 / Bug Fixes:

  • 修复 FPS 计算的两个根本性准确度问题
    • Fixed two fundamental accuracy issues in FPS calculation
    • 问题 1:帧时间戳使用 DateTime.now() 而非帧真实时间戳。由于 addTimingsCallback 是批量回调,同一批多帧会共享几乎相同的时间戳,导致滑动窗口 FPS 计算在窗口边缘抖动、批量到达时失真
    • Issue 1: Frame timestamps used DateTime.now() instead of real frame timestamps. Since addTimingsCallback is batched, multiple frames in the same batch shared nearly identical timestamps, causing sliding-window FPS to jitter at window edges and distort on batch arrivals
    • 修复 1:改用 timing.timestampInMicroseconds(FramePhase.buildStart) 获取每帧真实开始时间戳
    • Fix 1: Use timing.timestampInMicroseconds(FramePhase.buildStart) to get the real per-frame start timestamp
    • 问题 2:帧耗时只算 buildDuration(widget 树构建),漏掉了 rasterizationDuration(GPU 光栅化)。GPU 卡顿是 Flutter 最常见的卡顿类型之一,原实现完全检测不到
    • Issue 2: Frame duration only counted buildDuration (widget tree construction), missing rasterizationDuration (GPU rasterization). GPU jank — one of the most common Flutter jank types — was completely undetected
    • 修复 2:帧耗时改用 rasterFinish - buildStart,包含 build 和 raster 全过程
    • Fix 2: Frame duration now uses rasterFinish - buildStart, covering both build and raster phases
  • 修复引入真实时间戳后 FPS 显示 -- 的回归问题
    • Fixed regression where FPS displayed -- after switching to real frame timestamps
    • 根因_refreshFps()DateTime.now()(wall clock,自 1970 UTC)作为 "now" 来清理旧时间戳,而帧时间戳用的是 FramePhase.buildStart(monotonic time,自引擎启动)。两者时钟基准不同,差值巨大,导致所有帧时间戳在第一次刷新时被全部误清理,FPS 永远为 0
    • Root cause: _refreshFps() used DateTime.now() (wall clock, since 1970 UTC) as "now" to purge old timestamps, but frame timestamps used FramePhase.buildStart (monotonic time, since engine start). Different clock bases caused all timestamps to be erroneously purged on first refresh, making FPS always 0
    • 修复:用帧时间戳中的最大值作为 "now",确保时钟基准统一
    • Fix: Use the max frame timestamp as "now" to ensure a unified clock base
  • 移除未使用的 _frameStartTimes 字段(死代码清理)
    • Removed unused _frameStartTimes field (dead code cleanup)

Release v1.2.0

Choose a tag to compare

@github-actions github-actions released this 29 Jul 18:04

⚠️ 推荐所有用户立即升级 / Strongly recommended for all users to upgrade

本版本修复了悬浮按钮和检查器面板的根本性稳定性问题,并新增 FPS 监控演示。
This release fixes fundamental stability issues with the floating button and inspector panel, and adds FPS monitoring demos.

修复 / Bug Fixes:

  • 修复悬浮按钮从未通过 Overlay 正常显示的问题
    • Fixed issue where the floating button was never properly displayed via Overlay
    • 根因:原实现使用 Overlay.of(context, rootOverlay: true) 查找 Overlay,但 OverlayNavigator 的子组件而非祖先,导致查找结果为 null,按钮 OverlayEntry 从未被创建
    • Root cause: Original implementation used Overlay.of(context, rootOverlay: true) to find Overlay, but Overlay is a child of Navigator, not an ancestor, returning null and the button OverlayEntry was never created
    • 修复:改用 navigatorState.overlay 直接从 Navigator 获取其内部 Overlay,并加入下一帧重试机制应对 Navigator 未挂载的情况
    • Fix: Use navigatorState.overlay to get Overlay directly from Navigator, with next-frame retry when Navigator is not mounted
  • 修复开启 FPS 监控后悬浮按钮消失、面板无法展开的问题
    • Fixed issue where enabling FPS monitoring caused the floating button to disappear and the panel could not expand
    • 根因FpsService.notifyListeners() 会触发 Overlay 重建,叠加原 Overlay 查找失败,导致按钮 State 被销毁且无法恢复
    • Root cause: FpsService.notifyListeners() triggers Overlay rebuild; combined with the original Overlay lookup failure, the button State was destroyed and could not recover
  • 修复 OverlayEntry 内容报 "No Material widget found" 的问题
    • Fixed "No Material widget found" error in OverlayEntry content
    • 面板 OverlayEntry 内部的 TabBarIconButtonInkWell 等 Material 组件因 OverlayEntry 不在 MaterialApp widget 树中而无法找到 Material 祖先
    • Material widgets (TabBar, IconButton, InkWell) inside the panel OverlayEntry could not find a Material ancestor because OverlayEntry content is outside MaterialApp's widget tree
    • 修复:在面板 OverlayEntry 内部(Offstage 内部)包裹 Material(color: Colors.transparent) 作为祖先
    • Fix: Wrap Material(color: Colors.transparent) inside Offstage to provide the Material ancestor
  • 修复 OverlayEntry 的 Material 包裹导致下方页面无法点击/滑动的问题
    • Fixed issue where Material wrapper in OverlayEntry made the underlying page unclickable/unscrollable
    • 根因RenderMaterial 只要设置了 color(即使 Colors.transparent)就会在 hitTestSelf 返回 true,拦截所有触摸事件
    • Root cause: RenderMaterial with any color (even Colors.transparent) returns true in hitTestSelf, intercepting all touch events
    • 修复 1:按钮 OverlayEntry 不再包裹 Material(FloatingInspectorButton 内部无 InkWell/InkResponse,不需要 Material 祖先)
    • Fix 1: Button OverlayEntry no longer wraps Material (FloatingInspectorButton has no InkWell/InkResponse, no Material ancestor needed)
    • 修复 2:面板 OverlayEntry 中将 Material 放在 Offstage 内部,关闭面板时 RenderOffstage.hitTest 直接返回 false,Material 不参与命中测试,点击穿透到下方页面
    • Fix 2: In panel OverlayEntry, Material is placed inside Offstage; when the panel is closed, RenderOffstage.hitTest returns false directly, so Material never participates in hit testing and clicks pass through to the underlying page
  • 修复 FPS Tab 切换后内容消失的问题
    • Fixed issue where FPS Tab content disappeared after switching tabs
    • 使用 IndexedStack 替代 TabBarView,并为每个 viewer 添加 ValueKey 确保状态保持
    • Use IndexedStack instead of TabBarView, and add ValueKey to each viewer to ensure state preservation
  • 修复 AutomaticKeepAliveClientMixinIndexedStack 冲突导致状态销毁的问题
    • Fixed state destruction caused by conflict between AutomaticKeepAliveClientMixin and IndexedStack
    • 移除所有 viewer(network/log/database/memory/fps/route)中的 AutomaticKeepAliveClientMixin
    • Remove AutomaticKeepAliveClientMixin from all viewers (network/log/database/memory/fps/route)
  • 修复 FPS 计算严重偏低的问题(实际 60 FPS 仅显示 9-10)
    • Fixed severely undercounted FPS (real 60 FPS showed only 9-10)
    • 根因_onFrameTimings_recentFrameTimestamps.add(now) 在 for 循环外,而 Flutter 引擎的 addTimingsCallback批量回调,一次可能返回多帧,但代码每批只记录 1 个时间戳,导致 FPS 计算偏低 6-10 倍
    • Root cause: _recentFrameTimestamps.add(now) was outside the for-loop in _onFrameTimings; Flutter engine's addTimingsCallback is batched (may return multiple frames per call), but only one timestamp was added per batch, undercounting FPS by 6-10x
    • 修复:将 _recentFrameTimestamps.add 移入 for 循环内,使用 timing.timestamp.inMicroseconds 为每帧单独记录时间戳
    • Fix: Move _recentFrameTimestamps.add inside the for-loop, using timing.timestamp.inMicroseconds to record a timestamp per frame

新功能 / New Features:

  • 悬浮按钮新增边缘吸附收入功能
    • Floating button now auto-docks and tucks into screen edge
    • 拖动松手后自动吸附到最近边缘,平滑动画"收入"边缘仅露出 24px 小弧边
    • Auto-docks to nearest edge on release with smooth animation; tucks into edge leaving only a 24px peek
    • 收入状态下点击露出部分会平滑拉出到完整可见位置(不打开面板,避免误触),再次点击才打开面板
    • Tapping the peek smoothly pulls it out to fully visible (panel not opened, avoids accidental open); tap again to open the panel
    • 此设计避免了从吸附态拖出时与系统返回手势(Android/iOS 边缘右滑退出)的冲突
    • This design avoids conflict with system back gestures (Android/iOS edge swipe to go back) when pulling out from docked state
    • 收入时图标变为方向箭头(左吸附→右箭头,右吸附→左箭头),提示可点击拉出
    • Icon changes to directional chevron when tucked (left dock → right chevron, right dock → left chevron) hinting at tap-to-pull-out
    • 非吸附状态保持虫子图标,点击直接打开面板
    • Bug icon preserved when not docked; tap directly opens the panel
  • Example App 新增 FPS 演示模块
    • Example App adds FPS demo module
    • Trigger Jank 按钮(阻塞主线程 100-500ms 模拟掉帧)
    • Trigger Jank button (blocks main thread 100-500ms to simulate jank)
    • Heavy Animations 演示(80 个同时旋转+缩放的 widget 故意触发掉帧)
    • Heavy Animations demo (80 simultaneously rotating+scaling widgets to intentionally trigger jank)
    • Smooth Animation 演示(单个轻量复合动画,演示稳定 60 FPS)
    • Smooth Animation demo (single lightweight compound animation, demonstrates stable 60 FPS)

Release v1.1.2

Choose a tag to compare

@github-actions github-actions released this 28 Jul 20:57

优化 / Improvements:

  • 简化内存泄漏检测 UI 文案,移除代码示例,仅保留使用提醒
    • Simplified memory leak detection UI instructions by removing code demo and keeping only usage reminders
  • 过滤网络请求列表中的 WebSocket 握手请求(如 VM Service /ws 端点),避免连接重试时刷屏
    • Filtered WebSocket handshake requests (e.g. VM Service /ws endpoints) from the network request list to prevent flooding during connection retries
  • 优化内存趋势图:新增 X 轴(时间轴 -2m/-1m/Now)和 Y 轴(内存值 Max/Mid/Min)刻度标签,新增 Min 最小值图例,让趋势变化更清晰直观
    • Optimized memory trend chart: added X-axis (time axis -2m/-1m/Now) and Y-axis (memory value Max/Mid/Min) tick labels, added Min value legend, making trend changes clearer and more intuitive
  • 新增简化的日志记录 API:InspectorLog 静态类,支持 InspectorLog.v/d/i/w/e() 短名方法调用
    • Added simplified logging API: InspectorLog static class, supporting InspectorLog.v/d/i/w/e() short-name method calls
  • 新增简化的内存泄漏追踪 API:trackMemoryLeak / untrackMemoryLeak 顶层函数和 Object.trackMemoryLeak() 扩展方法
    • Added simplified memory leak tracking API: trackMemoryLeak / untrackMemoryLeak top-level functions and Object.trackMemoryLeak() extension method
  • 补充单元测试覆盖新 API,总测试数达到 112 条
    • Added unit tests covering the new API, total tests reached 112