gpt4 book ai didi

dart - indexed_db-objectstore.delete-onSuccess

转载 作者:行者123 更新时间:2023-12-03 03:48:00 25 4
gpt4 key购买 nike

有人可以告诉我下面的代码怎么了。主要问题是该行:

fDbListAllClients;    // this is not being "called"

似乎没有执行。

也可能有其他错误代码。我不担心是否需要检查删除,我想知道是什么原因导致未执行相关行的问题。

fDbDeleteOneClient(String sKey) {
var oDbTxn = ogDb1.transaction(sgTblClient, 'readwrite');
var oDbTable = oDbTxn.objectStore(sgTblClient);
var oDbRecord = oDbTable.getObject(sKey);
oDbRecord.onSuccess.first.then((val) {if (oDbRecord.result == null) {
window.alert("Record $sKey not found and cannot be deleted");
return;}});
var oDbDelReq = oDbTable.delete(sKey);
oDbDelReq.onSuccess.first.then((val1) {
var oDbRecord = oDbTable.getObject(sKey); // check if it was deleted
oDbRecord.onSuccess.first.then((val2){
if (oDbRecord.result != null) {
window.alert("Record $sKey was found but cannot be deleted");
}
});
fDbListAllClients; // this is not being "called"
});
oDbDelReq.onError.first.then((e) => window.alert(
"Error on Delete of $sKey. Error = ${e}"));
}

最佳答案

问题或主要问题的一部分是需要使用onSuccess.listen()。当有人回答另一个问题时:

“onSuccess是一个流。如果您想接收多个元素,只需为其“监听”:onSuccess.listen。”

关于dart - indexed_db-objectstore.delete-onSuccess,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14661641/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com