peers property

  1. @override
List<PeerId> get peers
override

Returns the peers connected

Implementation

@override
List<PeerId> get peers {
  final result = <PeerId>[];

  for (final entry in _connections.entries) {
    // Only include peers with active connections
    final conns = entry.value;
    if (conns.any((conn) => !conn.isClosed)) {
      // Add the peer ID
      if (conns.isNotEmpty) {
        result.add(conns.first.remotePeer);
      }
    }
  }

  return result;
}