find static method

Future<Router?> find()

Returns the first router found or null if none was found

Implementation

static Future<Router?> find() async {
  try {
    final discovery = DeviceDiscoverer();
    final client = await discovery
        .quickDiscoverClients(
            timeout: const Duration(seconds: 10),
            query: CommonDevices.wanRouter)
        .first;

    final device = await client.getDevice();
    discovery.stop();
    final router = Router(device);
    await router.init();
    return router;
  } catch (e) {
    return null;
  }
}