InternetChecker class

Performs real internet reachability checks via DNS lookup.

This is more reliable than connectivity_plus alone, which only checks if a network interface is available — not whether the internet is actually reachable (e.g. captive portal, firewall, DNS failure).

final checker = InternetChecker();

// One-shot check
final isOnline = await checker.hasInternetAccess();

// Periodic stream
checker.startPeriodicCheck();
checker.statusStream.listen((isOnline) {
  print('Internet: $isOnline');
});

Constructors

InternetChecker({InternetCheckerConfig? config, NetworkLogger? logger})

Properties

hashCode int
The hash code for this object.
no setterinherited
lastResult bool
Last known internet reachability result.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusStream Stream<bool>
Stream of internet reachability changes (deduped).
no setter

Methods

dispose() Future<void>
Dispose resources.
hasInternetAccess() Future<bool>
Perform a one-shot internet reachability check.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startPeriodicCheck() → void
Start periodic internet checks.
stopPeriodicCheck() → void
Stop periodic checks.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited