effectivePeerSource property
PeerSource
get
effectivePeerSource
Implementation
PeerSource get effectivePeerSource {
if (staticRelays != null && staticRelays!.isNotEmpty) {
return (int numPeers) {
final controller = StreamController<AddrInfo>();
final effectiveNum = numPeers < staticRelays!.length ? numPeers : staticRelays!.length;
for (int i = 0; i < effectiveNum; i++) {
controller.add(staticRelays![i]);
}
controller.close();
return controller.stream;
};
}
if (peerSourceCallback != null) {
return peerSourceCallback!;
}
throw StateError('AutoRelayConfig must have either staticRelays or a peerSourceCallback.');
}