alibaba / flutter_boost

FlutterBoost is a Flutter plugin which enables hybrid integration of Flutter for your existing native apps with minimum efforts
https://github.com/alibaba/flutter_boost
MIT License
6.98k stars 1.23k forks source link

[Bug]: flutterboost方式push页面快速返回,会抛异常,有demo #2151

Open CY-J-CY opened 3 days ago

CY-J-CY commented 3 days ago

请描述遇到的问题,以及您所期望的正确的结果

flutter页面A 点击按钮通过 BoostNavigator.instance.push 方式 跳转到 flutter页面 B,快速点击返回A(这一步一定要快,进页面马上出来),在A页面再次点击按钮进入flutter页面B,必抛红报错,demo中页面A点击红色区域跳转到页面B,立即点击B页面的红色区域返回页面A,在点击A的红色区域必报错。 通过系统的方式 Navigation.of(context).push 试过是正常的. 在项目中出现了,用了最简单的demo可以复现。麻烦大大看下是什么原因。

请说明如何操作会遇到上述问题

The following StateError was thrown building HeroControllerScope: Bad state: Future already completed

The relevant error-causing widget was: MaterialApp MaterialApp:file:///Users/kavin/Documents/lib/main.dart:37:12 When the exception was thrown, this was the stack:

1 Route.didComplete (package:flutter/src/widgets/navigator.dart:362:19)

2 _RouteEntry.handleComplete (package:flutter/src/widgets/navigator.dart:2983:11)

3 NavigatorState._flushHistoryUpdates (package:flutter/src/widgets/navigator.dart:4065:17)

4 NavigatorState._updatePages (package:flutter/src/widgets/navigator.dart:3969:5)

5 NavigatorState.didUpdateWidget (package:flutter/src/widgets/navigator.dart:3613:7)

6 StatefulElement.update (package:flutter/src/widgets/framework.dart:5471:55)

7 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

8 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

9 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

10 ProxyElement.update (package:flutter/src/widgets/framework.dart:5628:5)

11 Element.updateChild (package:flutter/src/widgets/framework.dart:3685:15)

12 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5322:16)

13 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)

14 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)

15 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2779:19)

16 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:916:21)

17 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:360:5)

18 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1297:15)

19 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1227:9)

20 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1085:5)

21 _invoke (dart:ui/hooks.dart:170:13)

22 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:401:5)

23 _drawFrame (dart:ui/hooks.dart:140:31)

flutter_boost_test.zip

在下面填入关键复现代码

No response

复现的平台

Both

Flutter SDK版本

3.13.5

FlutterBoost版本

4.4.1

是否延迟初始化FlutterBoost

No

解决方案

No response

joechan-cq commented 3 days ago

duplicate #1863, PR #1991

kavin-zhihua commented 3 days ago

duplicate #1863, PR #1991 flutter_boost_test.zip

您好 我把flutterboost版本切换到了main分支 6dff80cc提交,问题依旧存在。附demo

joechan-cq commented 3 days ago

main分支上没有这个PR,之前分支有过一次调整,原先的main分支变成了dev/exp分支,具体修改参考PR里的boost_container.dart里的修改试一下