attachViewer function
void
attachViewer({
- @Author: chuxiong
- @Created at: 2026/10/27
- @Email:
- @Company: 嘉联支付
- description 日志查看器挂载入口:悬浮球(拖拽 / 吸边 / 点击开面板)+ 控制器 挂载日志查看器悬浮球:LogViewerController.attach 的顶层入口。
void main() {
final navigatorKey = GlobalKey<NavigatorState>();
runApp(MaterialApp(navigatorKey: navigatorKey, ...));
attachViewer(navigatorKey: navigatorKey);
}
首帧前调用也安全——内部逐帧等根 Overlay 就绪(见 LogViewerController.attach)。 不调用即无球、无桥接输出器,运行时行为零变化。
Implementation
/// 挂载日志查看器悬浮球:[LogViewerController.attach] 的顶层入口。
///
/// ```dart
/// void main() {
/// final navigatorKey = GlobalKey<NavigatorState>();
/// runApp(MaterialApp(navigatorKey: navigatorKey, ...));
/// attachViewer(navigatorKey: navigatorKey);
/// }
/// ```
///
/// 首帧前调用也安全——内部逐帧等根 Overlay 就绪(见 [LogViewerController.attach])。
/// 不调用即无球、无桥接输出器,运行时行为零变化。
void attachViewer({required GlobalKey<NavigatorState> navigatorKey}) =>
LogViewerController.attach(navigatorKey: navigatorKey);