HttpInternetProbe class final
Tries independent HTTP endpoints until one returns its expected status.
Each clientFactory call must return a fresh client. This probe owns and
closes every client, including requests that time out. A captive portal's
redirect or login page does not satisfy the default 204 checks.
Constructors
-
HttpInternetProbe({Iterable<
InternetCheckEndpoint> ? endpoints, Client clientFactory()?, Duration timeout = const Duration(seconds: 4)}) - Creates a probe with Google and Cloudflare as the default endpoints.
Properties
-
endpoints
→ List<
InternetCheckEndpoint> -
The endpoints in fallback order.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeout → Duration
-
Maximum time allowed per endpoint, excluding the next fallback check.
final
Methods
-
call(
) → Future< bool> - Returns true if an endpoint is reachable; transport failures return false.
-
close(
) → void - Cancels owned clients and releases pending checks. Safe to call twice.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
defaultEndpoints
→ List<
InternetCheckEndpoint> -
The default endpoints, each requiring an exact HTTP 204 response.
final