InheritedWidget中的BloC调用null

问题描述

我正在使用Inherited Widget,尽管我有一个类似的项目正在工作,但在这里我得到了the getter '***Bloc' was called on null

问题是,仅当我在Android Studio终端上运行Flutter运行时,才会发生这种情况。如果我使用Android Studio工具栏上的“运行”按钮,则可以正常运行。 Build-> Flutter-> Build APK也会引发null调用

我尝试使用Flutter Inspector:

enter image description here

HomeBody()调用MyApp内部的bloc。我还认为问题可能是Material是MyApp的子级,它是从InheritedWidget继承而来的,但是我的其他项目也是如此。它们之间的唯一区别是,该屏幕具有启动屏幕,似乎包含了问题。

遵循我的代码

enter image description here

enter image description here

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)