keepSynced function
Keeps path in sync with no listener attached, so a later read is served
from cache rather than the network.
Returns as soon as the SDK has taken the instruction; there is nothing to wait for.
Implementation
void keepSynced(String path, bool keep, [DbQuery? query]) {
final encoded = (query ?? const DbQuery())._encode();
final p = path.toNativeUtf8();
final buf = calloc<Uint8>(encoded.isEmpty ? 1 : encoded.length);
if (encoded.isNotEmpty) {
buf.asTypedList(encoded.length).setAll(0, encoded);
}
try {
final rc = fdbDbKeepSynced(p.cast(), buf, encoded.length, keep ? 1 : 0);
if (rc != 0) throw _refuse(rc, 'keepSynced');
} finally {
calloc
..free(p)
..free(buf);
}
}