[英]How I can get memberId for Provider.of
Heloo everybody.大家好。 I want to ask you, how i can delete my ListView item,and send this to the Provider.of<Members>(context)
我想问你,我如何删除我的 ListView 项目,并将其发送给 Provider.of<Members>(context)
I used to try many variants of changing.我曾经尝试过许多变化的变体。 But in some case i get 'a dismissed dismissible widget is still part of the tree' error.
但在某些情况下,我会收到“一个已关闭的可关闭小部件仍然是树的一部分”错误。 In another after restate my ListView stay without change.
在另一个重述之后,我的 ListView 保持不变。 I understan that problem is Provide to 'void removeMember' member id.
我明白问题是提供给“void removeMember”成员 ID。
GitHub url https://github.com/Rodion98/wor_app.git GitHub 网址https://github.com/Rodion98/wor_app.git
your delete item logic is wrong, just try this你的删除项目逻辑是错误的,试试这个
void removeMember(String memberId) {
_items.remove(_items.firstWhere((element) => element.idl == memberId));
notifyListeners();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.