-
安卓通过
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
相关推荐
程序员老刘·21 分钟前
从短剧App的bug看响应式编程在AI时代的优势传奇开心果编程12 小时前
【Flutter踩坑排雷】第7课:巨型 build 函数坑|全部 UI 写在同一个 build,维护难、隐性异常程序员老刘15 小时前
从短剧App的bug看响应式编程在AI时代的优势恋猫de小郭1 天前
最近 Android 有什么更新:Android Dev Summit 2026 技术解读好的佩奇1 天前
Dart 之类修饰符好的佩奇012 天前
Dart 之类修饰符Jewel1052 天前
文字为什么总是不居中!记录一个bug2601_949847753 天前
Form-data 跨端三方库仓颉适配全流程大龄秃头程序员3 天前
Flutter 中我为什么把 GetX 定位为高效率方案,而不是默认架构方案传奇开心果编程3 天前
组合优先开发范式:从汉字造字原理到声明式UI组件组合思想