有人可以向我解释以下代码有什么问题。该行.then((result) {window.alert("Record = ${oDbRec}");})
显示以下内容:
记录 = '_ThenFuture@0x2900bd4a' 的实例
我想要的是getObject()
. 编码:
fHtmDisplayOneClient(String sKey) {
var oDbRec;
oDbRec = fDbSelectOneClient(sKey)
.then((result) {window.alert("Record = ${oDbRec}");})
..catchError((oError) {window.alert("Error from fDbSelectOneClient. ${oError}");
});
}
Future fDbSelectOneClient(String sKey) {
var completer = new Completer();
idb.Transaction oDbTxn = ogDb1.transaction(sgTblClient, 'readwrite');
idb.ObjectStore oDbTable = oDbTxn.objectStore(sgTblClient);
idb.Request oDbReqGet = oDbTable.getObject(sKey);
oDbReqGet.onSuccess.first.then((val) => completer.complete(oDbReqGet.result));
oDbReqGet.onError.first.then((err) => completer.completeError(err));
return completer.future; // return the future
}