失败断言:第6276行POS 12:' child == _CHILD':不正确。当在颤音中使用溪流
我的状态有一个基于提供程序的流控制器
final PanelController panelController = PanelController();
StreamController<bool> closeToDstStream = StreamController<bool>();
void showPanelOnCloseToDst(LocationData locationData, dynamic smartCheckData,
UserRepository userRepository, UserprofileBloc userprofileBloc) async {
...some other irrelevant code here...
if (distanceFromDestination < 100) {
closeToDstStream.add(true);
if(panelController.isPanelClosed){
panelController.show();
}
} else {
closeToDstStream.add(false);
}
}
然后在 ui 上我使用控制器提供的流,如下所示
OrderFlowProvider _orderFlow = Provider.of<OrderFlowProvider>(context);
...other widgets here...
StreamBuilder<bool>(
stream: _orderFlow.closeToDstStream.stream,
builder: (context, snapshot) {
bool enabled = snapshot.hasData && snapshot.data;
return SharedButton(
text: "Arrived at Pick Up${snapshot.data}",
disable: !enabled,
onTap: () async {}
})
这个小部件位于 这个包可以显示或隐藏。当这个小部件最初加载时,一切都很好。 但是当我隐藏然后尝试使用上面的代码再次显示它时,它给我带来了错误
Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed
assertion: line 6276 pos 12: 'child == _child': is not true.
I have a stream controller in my state that is based off provider
final PanelController panelController = PanelController();
StreamController<bool> closeToDstStream = StreamController<bool>();
void showPanelOnCloseToDst(LocationData locationData, dynamic smartCheckData,
UserRepository userRepository, UserprofileBloc userprofileBloc) async {
...some other irrelevant code here...
if (distanceFromDestination < 100) {
closeToDstStream.add(true);
if(panelController.isPanelClosed){
panelController.show();
}
} else {
closeToDstStream.add(false);
}
}
Then on the ui Im using the stream provided by the controller as follows
OrderFlowProvider _orderFlow = Provider.of<OrderFlowProvider>(context);
...other widgets here...
StreamBuilder<bool>(
stream: _orderFlow.closeToDstStream.stream,
builder: (context, snapshot) {
bool enabled = snapshot.hasData && snapshot.data;
return SharedButton(
text: "Arrived at Pick Up${snapshot.data}",
disable: !enabled,
onTap: () async {}
})
This widget is in a sliding up panel from this package that can be shown or hidden. When this widget loads initally everything is fine.
But when i hide then try to show it again using the code above from state it gets me the error
Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed
assertion: line 6276 pos 12: 'child == _child': is not true.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论