-
安卓通过
scheme调起未启动的APP,进入APP后会白屏一会然后报错:A GlobalKey was used multipletimes inside one widget'schild list.The offending GlobalKey was:[LabeledGlobalKey<Navigatorstate>#7a685 Key Created bydefault]The parent of the widgets withthat key was:FocusInheritedscopeThe first child to getinstantiated with that keybecame:Navigator-[LabeledGlobalKey<NavigatorState>#7a685 KeyCreated by default]The second child that was tobe instantiated with that keywas :FocusInheritedScopeA GlobalKey can only bespecified on one widget at atime in the widget tree.See also: https://docs,flutter.dev/testing/ -
原因就是使用的
initialRoute没有配置完全导致的dart/// MaterialApp Widget buildMaterialApp(BuildContext context) { return GetMaterialApp( title: '水哥自用框架', // ...更多配置 // 这是正常的配置,指定初始路由 initialRoute: widget.initialRoute, // 这是这是路由列表 getPages: appRoutes.getPages, // 注意:就是这没有配置导致的,找不到路由的情况需要指定一个路由,可以设置为初始化的路由,也可以设置为找不到页面的路由 // 配置好这个就不会报错了。 unknownRoute: GetPage(name: appRoutes.initialRoute, page: () => widget.initialRoutePage), ); }scheme为什么会出现找不到路由?例如:dzm://?id=123与dzm:///tabbar?id=123前者就会被认为没有指定页面,后者不会出现问题,会进入到/tabbar页面。也可以通过强制给
scheme解决问题,也可以通过配置好unknownRoute解决问题。
Flutter A GlobalKey was used multipletimes inside one widget'schild list.The ...
卡尔特斯2025-09-17 14:21
相关推荐
恋猫de小郭2 小时前
Flutter 全新真 3D 实现,用 flutter_scene 能开发一个「我的世界」woshihuanglaoshi2 小时前
数据迁移与版本管理 - Flutter在鸿蒙平台实现数据库升级策略GitLqr12 小时前
玩转 WebSocket:从原理到 Flutter 实战世人万千丶12 小时前
参数管理_Flutter在鸿蒙平台路由参数最佳实践zhazhazsy19 小时前
Flutter 多 Isolate 实战:搭建主 Isolate 数据与能力桥math_hongfan21 小时前
鸿蒙Flutter setState机制深入理解woshihuanglaoshi1 天前
参数验证_Flutter在鸿蒙平台确保路由参数类型安全末代iOS程序员华仔1 天前
Swift 的角色演变:从“主角”到“最佳配角”——iOS 应用被 Flutter 替换,Swift 变成辅助?_阿南_1 天前
不是每一个Widget都会生成一个RenderObject世人万千丶1 天前
鸿蒙Flutter Flex多子组件权重分配