flutter - bulderFunctions 的 openContainer 之上的提供者
问题描述
ChangeNotifierProvider(
create: (context) => BuyValuableNotifier(),
child: OpenContainer(
closedBuilder: (context, action) {
return Container();
},
openBuilder: (context, action) {
return SingleWidget();
},
),
),
所以调用 openBuilder 时出现此错误:错误:在此 SingleWidget 小部件上方找不到正确的提供程序
OpenContainer(
closedBuilder: (context, action) {
return Container();
},
openBuilder: (context, action) {
return ChangeNotifierProvider(
create: (context) => BuyValuableNotifier(),
child: SingleWidget();
},
),
如果我这样做,我会在 openBuilder 关闭时丢失数据我该怎么办?
解决方案
推荐阅读
- python - 在 Python 中从文本文件创建变量
- excel - 在 Powershell 生成的 Excel 文件中格式化图表 DataLabel
- python - Docker即使在杀死后也继续在后台运行进程
- mysql - 如何根据同一表中的字段在一个字段中插入和增加一个值
- flutter - MethodChannel、EventChannel 和 BasicMessageChannel 有什么区别?
- vba - 列表框 - 第一项保持选中状态
- python - WTForms 未将正确的数据类型保存到数据存储区
- azure - 如何验证来自个人 Microsoft 帐户的令牌?
- haskell - “Prelude.read: no parse”,自己的数据类型
- python - itertools.chain 返回一个意外的迭代器