InternetChecker class

Performs real Internet reachability checks against one or more HTTP(S) endpoints.

Connectivity type alone (Wi-Fi, mobile) does not tell you whether the device can actually reach the Internet — captive portals, router misconfiguration, or a local-only network can all report a connected link with no upstream access. This class answers that question directly, with configurable endpoints and fallbacks so a single provider outage isn't mistaken for "no Internet".

Constructors

InternetChecker({required List<String> urls, Duration timeout = const Duration(seconds: 5), Client? client})
Creates an InternetChecker.

Properties

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
Per-endpoint timeout.
final
urls List<String>
The fallback endpoints checked, in order.
final

Methods

check() Future<InternetCheckResult>
Checks urls in order and returns as soon as one succeeds.
dispose() → void
Releases the underlying HTTP client, if this instance created it.
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