我在使用 idb.ObjectStore.put 的新语法 (r18915) 时遇到问题。有人可以帮忙吗?示例如下,导致错误如下:
AsyncError: ‘Error:DataError: DOM IDBDatabase Exception 0’
Stack trace: #0 ObjectStore._put_2(file:///E:/b/build/slave/dartium-win-full-trunk/build/src/build/Release/obj/
global_intermediate/webkit/bindings/dart/indexed_db/ObjectStore.dart:141:3) #1
ObjectStore.$dom_put(file:///E:/b/build/slave/dartium-win-full-trunc/build/src/build/Release/obj/
global_intermediate/webkit/bindings/dart/indexed_db/ObjectStore.dart:137:18) #2
ObjectStore.put(file:///E:/b/build/slave/dartium-win-full-trunc/build/src/build/Release/obj/
global_intermediate/webkit/bindings/dart/indexed_db/ObjectStore.dart:9:27)
我正在使用的代码正在运行,但已针对新版本进行了修改,如下所示:
Future fDbAddOrUpdateClient(String sKey1, ClassClientData clClientData) {
idb.Transaction oDbTxn = ogDb1.transaction(sgStoreClient, 'readwrite');
idb.ObjectStore oDbStoreClient = oDbTxn.objectStore(sgStoreClient);
Completer completer = new Completer();
var oDbReqPut = oDbStoreClient.put(
{'sKey': sKey1,
'sNameTitle' : clClientData.sNameTitle,
'sNameFamily' : clClientData.sNameFamily,
'sNameGiven1' : clClientData.sNameGiven1,
'sNameGiven2' : clClientData.sNameGiven2
})
.then((val){
completer.complete(val);
return;
})
.catchError((e){
window.alert("${e}");
return;
});
}