latestObligationsLedgerIn function

ObligationsLedger? latestObligationsLedgerIn(
  1. List<SessionRecord> entries
)

The latest snapshot in file order over entries, or null when the list has none. THIS IS THE RESIDENT VIEW ONLY: on a windowed session the latest snapshot can lie below the resident tail — callers on the resume path must fall back to the raw scan (JsonlSessionRepo.readCustomRecordsOfType; see the library doc).

Implementation

ObligationsLedger? latestObligationsLedgerIn(List<SessionRecord> entries) {
  ObligationsLedger? latest;
  for (final entry in entries) {
    if (entry is CustomRecord &&
        entry.customType == obligationsLedgerRecordType &&
        entry.data is List) {
      latest = ObligationsLedger.fromPayload(entry.data);
    }
  }
  return latest;
}