resolveFullNodeId method

Future<String?> resolveFullNodeId(
  1. String prefix
)

Resolves an 8-character node ID prefix to the full UUID stored in the routing table.

This is used by NearbyConnectionManager._performSync to fix the per-peer dedup mismatch: endpoint names only carry an 8-char prefix, but MessageDeliveries records full UUIDs. On re-encounters, we need the full UUID to correctly query delivery history.

Returns null if no node with this prefix has been seen before (i.e., this is a first encounter — full sync is appropriate).

Implementation

Future<String?> resolveFullNodeId(String prefix) async {
  final node = await (select(nodes)
        ..where((t) => t.nodeId.like('$prefix%'))
        ..limit(1))
      .getSingleOrNull();
  return node?.nodeId;
}