getLeafId method
Returns the id of the active leaf record, or null at the tree root.
Implementation
@override
Future<String?> getLeafId() async {
// The tracked leaf is healed at load (issue #858) and every append
// sets a just-written id, so a persisted dangle is unreachable; the
// alarm below can only fire on a caller-mutated id (issue #1114).
final leafId = _currentLeafId;
if (leafId != null && !_byId.containsKey(leafId)) {
throw SessionException(
'Entry $leafId not found',
code: SessionErrorCode.invalidSession,
);
}
return leafId;
}