getByParentId method
Get By Parent Id in Box<T>
Implementation
Future<T?> getByParentId(int parentId) async {
for (var record in _indexedDB.allActiveRecordList) {
if (record.type != RecordType.json) continue;
final jsonRec = (record as JsonRecord);
if (jsonRec.parentId == parentId) {
// read json data
final raf = await _indexedDB.dbFile.open();
final data = await jsonRec.getJsonData(raf);
await raf.close();
if (data == null) continue;
return _adapter.fromMap(_adapter.decodeData(data));
}
}
return null;
}