get method
Reads data from local cache. Non-local collections fall back to server.
Implementation
Future<Map<String, dynamic>?> get({bool skipCache = false}) async {
if (!skipCache) {
final smart = _smartCache;
if (smart != null) {
final cached = await smart.get(_blockId);
if (cached != null) return _decode(cached);
}
final cache = _effectiveCache;
if (cache != null) {
final cached = await cache.get(_blockId);
if (cached != null) return _decode(cached);
}
}
// Local collections don't query the server
if (_local) return null;
Uint8List? bytes;
try {
bytes = await _ws.get(_blockId);
} catch (_) {
return null;
}
if (bytes == null) return null;
final smart = _smartCache;
if (smart != null) {
await smart.put(_blockId, bytes, isLocal: _local);
} else {
final cache = _effectiveCache;
if (cache != null) { await cache.put(_blockId, bytes); }
}
return _decode(bytes);
}