airpass_client library

Airpass Protocol — UI Client Facade

The clean API surface for the Flutter UI to interact with the background mesh networking system. All methods are safe to call from the main isolate.

Design Principles

  1. No direct network calls. sendMessage saves to the local DB as PENDING. The background AirpassSyncEngine handles delivery.

  2. Reactive. watchDiscoveredGroups and listenForMessages return Drift .watch() streams that emit historical data immediately, then live updates as the mesh syncs.

  3. Byte-limit validated. subscribeToGroup validates that the combined endpoint name stays under the 131-byte Nearby API limit before committing the subscription.

Usage

final client = getIt<AirpassClient>();

// Send a message
await client.sendMessage(payload: 'Help needed!', targetId: 'aid-sector-5');

// Watch groups
client.watchDiscoveredGroups().listen((groups) => updateUI(groups));

// Listen for messages
client.listenForMessages('protest-2026').listen((msgs) => showMessages(msgs));

// Join a group
await client.subscribeToGroup('protest-2026');

Classes

AirpassClient
The primary API for the Flutter UI to interact with the Airpass mesh.

Exceptions / Errors

GroupSubscriptionLimitException
Thrown when subscribing to a group would cause the encoded endpoint name to exceed the 131-byte Nearby Connections API limit.
MediaFileTooLargeException
Thrown when a media file exceeds the maximum allowed size.