We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
static void destroy({tag}) { _list.forEach((rxBus) { if (tag != null && tag != _DEFAULT_IDENTIFIER && rxBus.tag == tag) { rxBus.subject.close(); _list.remove(rxBus); } else if ((tag == null || tag == _DEFAULT_IDENTIFIER) && rxBus.tag == _DEFAULT_IDENTIFIER) { rxBus.subject.close(); _list.remove(rxBus); } }); } 在进行迭代循环时试图删除list中内容,导致异常抛出,建议的修改方案如: ///事件关闭 static void destroy({tag}) { var toRemove = []; _list.forEach((rxBus) { if (tag != null && tag != _DEFAULT_IDENTIFIER && rxBus.tag == tag) { rxBus.subject.close(); toRemove.add(rxBus); } else if ((tag == null || tag == _DEFAULT_IDENTIFIER) && rxBus.tag == _DEFAULT_IDENTIFIER) { rxBus.subject.close(); toRemove.add(rxBus); } }); toRemove.forEach((rxBus) { _list.remove(rxBus); }); }
The text was updated successfully, but these errors were encountered:
好的,稍后我测试完后会把这个更改提交上的
Sorry, something went wrong.
No branches or pull requests
static void destroy({tag}) {
_list.forEach((rxBus) {
if (tag != null && tag != _DEFAULT_IDENTIFIER && rxBus.tag == tag) {
rxBus.subject.close();
_list.remove(rxBus);
} else if ((tag == null || tag == _DEFAULT_IDENTIFIER) && rxBus.tag == _DEFAULT_IDENTIFIER) {
rxBus.subject.close();
_list.remove(rxBus);
}
});
}
在进行迭代循环时试图删除list中内容,导致异常抛出,建议的修改方案如:
///事件关闭
static void destroy({tag}) {
var toRemove = [];
_list.forEach((rxBus) {
if (tag != null && tag != _DEFAULT_IDENTIFIER && rxBus.tag == tag) {
rxBus.subject.close();
toRemove.add(rxBus);
} else if ((tag == null || tag == _DEFAULT_IDENTIFIER) &&
rxBus.tag == _DEFAULT_IDENTIFIER) {
rxBus.subject.close();
toRemove.add(rxBus);
}
});
toRemove.forEach((rxBus) {
_list.remove(rxBus);
});
}
The text was updated successfully, but these errors were encountered: