我一直试图从使用Dart的IndexedDb包的IndexedDb实例中获取单个条目。但我打电话给getObject()
其中说明文件返回Future
*(我不知道的未来)我没有任何Maps
或其他物体可以使用。在Dart中使用IndexedDb ObjectStore
Future
在store.getObject(id).then()
方法中返回什么?如果它不返回任何内容,我如何获取存储在数据库中的信息?
//within a TurnObjectStore class
Future<Turn> getTurn(int id){
Transaction t = _db.transaction(_TABLE_NAME, 'readonly');
ObjectStore store = t.objectStore(_TABLE_NAME);
return store.getObject(id).then((Map turn){
print('getTurn');
print(turn);
return turn;
});
}
类似的问题在这里回答indexed_db getObject() - how to return result,但我发现在我的IDE的警告,当我尝试这种方式,如果去年以来该规范已经改变了我不知道。