getItemSync method
dynamic
getItemSync(
- dynamic docId, {
- String? streamId,
})
Implementation
dynamic getItemSync(dynamic docId, {String? streamId}) {
if (!_cacheLoaded) {
throw StorageDatabaseException(
"Cache is not loaded. Call get() method first.",
);
}
dynamic item;
if (_cache is Map) {
item = _cache[docId];
} else if (_cache is List) {
if (docId is! int) {
throw const StorageDatabaseException("docId must be integer");
}
item = _cache[docId];
} else {
throw StorageDatabaseException(
"This Collection ($collectionId) does not support collections",
);
}
if (streamId != null && storageListeners.hasStreamId(path, streamId)) {
storageListeners.getDate(path, streamId);
}
return item;
}