From e99a0363b9b002c0f6f9bb98ffa219a07cf97869 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 21 May 2026 21:47:08 +0200 Subject: [PATCH] Replace the allowed connectivity list We now just test if there is obviously no connection, keeping an explicit list is brittle and would break if the plugin reported something non-obvious like "vpn" --- lib/providers/network_provider.dart | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/providers/network_provider.dart b/lib/providers/network_provider.dart index bd38e85d3..c384ef302 100644 --- a/lib/providers/network_provider.dart +++ b/lib/providers/network_provider.dart @@ -48,12 +48,6 @@ Future _defaultReachabilityCheck(Duration timeout) async { class NetworkStatus extends _$NetworkStatus { final _logger = Logger('NetworkStatus'); - static const allowed = { - ConnectivityResult.mobile, - ConnectivityResult.wifi, - ConnectivityResult.ethernet, - }; - StreamSubscription>? _sub; @override @@ -88,7 +82,11 @@ class NetworkStatus extends _$NetworkStatus { List conn, { Duration timeout = const Duration(seconds: 1), }) async { - if (!conn.any((c) => allowed.contains(c))) { + // Only short-circuit when there's clearly no network adapter at all. Any + // other connectivity type (wifi, ethernet, mobile, vpn, other, ...) still + // has to prove real reachability via the DNS check below. An empty list + // counts as "no connection" too. + if (conn.every((c) => c == ConnectivityResult.none)) { return false; } return reachabilityCheck(timeout);