debugLinkPayload function

Link debugLinkPayload(
  1. int id
)

Returns the payload still held by the slot for id, or an empty link.

Unlike live link resolution, this inspects zero-reference entries too, so regression tests can detect payloads retained after the last release.

Implementation

Link debugLinkPayload(int id) {
  final slot = _linkRegistry.slot(id);
  if (slot < 0 || slot >= _linkRegistry._slots.length) return const Link();
  final entry = _linkRegistry._slots[slot];
  if (entry == null || entry.id != id) return const Link();
  final payload = entry.payload;
  return payload == null
      ? const Link()
      : Link(url: payload.url, params: payload.params);
}