getObject()を使用してデータ型を定義する方法とオブジェクト(レコード)を返す方法を知りたいです。現在、結果(レコード)を取得する関数の外で使用できる唯一の方法は、結果を使用して別の関数を呼び出すことです。そうすれば、データ型を指定する必要はありません。ただし、値を返したい場合は、データ型を定義する必要があり、それが何であるかがわかりません。「ダイナミック」を試しましたが、うまくいかなかったようです。例えば ":
fDbSelectOneClient(String sKey, Function fSuccess, String sErmes) {
try {
idb.Transaction oDbTxn = ogDb1.transaction(sgTblClient, 'readwrite');
idb.ObjectStore oDbTable = oDbTxn.objectStore(sgTblClient);
idb.Request oDbReqGet = oDbTable.getObject(sKey);
oDbReqGet.onSuccess.listen((val){
if (oDbReqGet.result == null) {
window.alert("Record $sKey was not found - $sErmes");
} else {
///////return oDbReqGet.result; /// THIS IS WHAT i WANT TO DO
fSuccess(oDbReqGet.result); /// THIS IS WHAT i'm HAVING TO DO
}});
oDbReqGet.onError.first.then((e){window.alert(
"Error reading single Client. Key = $sKey. Error = ${e}");});
} catch (oError) {
window.alert("Error attempting to read record for Client $sKey.
Error = ${oError}");
}
}
fAfterAddOrUpdateClient(oDbRec) {
/// this is one of the functions used as "fSuccess above