probe method

Future<bool?> probe(
  1. Uri url
)

Sends a HEAD request to url to check reachability.

Returns true when the server responds with a 2xx/3xx status, false on a 4xx/5xx, and null on connection failure.

Implementation

Future<bool?> probe(Uri url) async {
  try {
    await _gate.acquire();
    final res = await _http.head(url).timeout(const Duration(seconds: 8));
    return res.statusCode < 400;
  } catch (_) {
    return null;
  } finally {
    _gate.release();
  }
}