waitForHellos method

Future<void> waitForHellos(
  1. int n, {
  2. Duration timeout = const Duration(seconds: 5),
})

Resolves when the hub has seen n signature-verified hellos. timeout bounds the wait — the default 5s suits unit tests; PTY integration tests on loaded runners pass 30s (the CLI's dial rides a cold dart VM behind a TUI boot).

Implementation

Future<void> waitForHellos(
  int n, {
  Duration timeout = const Duration(seconds: 5),
}) async {
  if (_hellosSeen >= n) return;
  await hellos.firstWhere((_) => _hellosSeen >= n).timeout(timeout);
}