findAll static method

Stream<Router> findAll({
  1. bool silent = true,
  2. bool unique = true,
  3. bool enableIpv4Only = true,
  4. Duration timeout = const Duration(seconds: 10),
})

Returns a stream of discovered devices with DIAL capabilities. If unique, already found devices won't be added again to the stream. If silent, no exceptions will be passed to the returned stream.

Implementation

static Stream<Router> findAll(
    {bool silent = true,
    bool unique = true,
    bool enableIpv4Only = true,
    Duration timeout = const Duration(seconds: 10)}) async* {
  final discovery = DeviceDiscoverer();
  await discovery.start(ipv4: true, ipv6: !enableIpv4Only);
  await for (DiscoveredClient client in discovery.quickDiscoverClients(
      timeout: timeout, query: CommonDevices.wanRouter, unique: unique)) {
    try {
      final device = await client.getDevice();
      final router = Router(device);
      await router.init();
      yield router;
    } catch (e) {
      if (!silent) {
        rethrow;
      }
    }
  }
}