在使用flutterboost时,flutter sdk升级后,ios手机启动手有时会报如下错误,导致应用启动后一直卡着白屏
FlutterBoost#Oops, Failed to update overlay. mode=BoostSpecificEntryRefreshMode.add, BoostContainer(name:/, pages:[BoostPage(name:/, uniqueId:1673405039195_/, arguments:null)])
查找flutterboost issue问题列表,找了个遍,终于找到了解决方案:
将如下代码延迟执行300ms后,白屏问题处理了
FlutterBoostAppState#initState()中
@overridevoidinitState() { ... ...WidgetsBinding.instance!.addPostFrameCallback((_) {// try to restore routes from host when hot restart.assert(() {_restoreStackForHotRestart();returntrue; }());refreshOnPush(initialContainer);//延迟执行Future.delayed(Duration(milliseconds:300)).then((value) { _boostFlutterRouterApi.isEnvReady=true;_addAppLifecycleStateEventListener();BoostOperationQueue.instance.runPendingOperations(); }); }); }