-
安卓通过
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
相关推荐
晚烛1 天前
实战前瞻:构建高可靠、低延迟的 Flutter + OpenHarmony 智慧交通出行平台ujainu小1 天前
Flutter 权限管理实战手册:permission_handler 全平台适配与最佳实践子榆.1 天前
Flutter 与开源鸿蒙(OpenHarmony)工程化实践:CI/CD、性能监控与多端发布QuantumLeap丶1 天前
《Flutter全栈开发实战指南:从零到高级》- 26 -持续集成与部署晚烛1 天前
实战前瞻:构建高安全、强协同的 Flutter + OpenHarmony 智慧金融移动银行平台(支持国产密码体系、生物认证与信创全栈适配)子榆.1 天前
Flutter 与开源鸿蒙(OpenHarmony)国际化与无障碍适配指南:打造真正包容的跨平台应用子榆.1 天前
Flutter 与开源鸿蒙(OpenHarmony)深度集成:从原理到实战进阶子榆.1 天前
Flutter 与开源鸿蒙(OpenHarmony)的融合:跨平台开发新纪元走在路上的菜鸟1 天前
Android学Dart学习笔记第二十三节 类-扩展类型晚烛1 天前
智启工厂脉搏:基于 OpenHarmony + Flutter 的信创工业边缘智能平台构建实践