Engine behind UNetwork; use UNetwork instead.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
- isCellular → bool
-
Same as UNetwork.isCellular.
no setter
- isEthernet → bool
-
Same as UNetwork.isEthernet.
no setter
- isMetered → bool
-
Same as UNetwork.isMetered.
no setter
- isOffline → bool
-
Same as UNetwork.isOffline.
no setter
- isOnline → bool
-
Same as UNetwork.isOnline.
no setter
- isVpn → bool
-
Same as UNetwork.isVpn.
no setter
- isWifi → bool
-
Same as UNetwork.isWifi.
no setter
-
listenable
→ ValueListenable<
UNetworkStatus> -
For
ValueListenableBuilder/AnimatedBuilder.no setter - offlineGrace ↔ Duration
-
How long "offline" must persist before it is reported. Zero reports every blip.
getter/setter pair
-
onlineStream
→ Stream<
bool> -
Emits only when online ↔ offline flips.
no setter
- probeCacheDuration ↔ Duration
-
How long a hasInternet answer is reused.
getter/setter pair
-
probeUrls
↔ List<
Uri> ? -
Checked by hasInternet, first answer wins. Put your own API first: it is the one
host that matters, and it is reachable on networks that filter public probes.
Defaults to
U.baseUrlfollowed by two public 204 endpoints.getter/setter pair - status → UNetworkStatus
-
Current state, updated live. Before init completes it reads as online.
no setter
-
stream
→ Stream<
UNetworkStatus> -
Every change of status.
no setter
Static Methods
-
addresses(
{bool includeLoopback = false}) → Future< List< UNetworkAddress> > -
This device's IP addresses (empty on the web). Loopback is skipped unless
includeLoopback. -
dispose(
) → Future< void> - Stops listening (tests, or an app that never needs network state again).
-
hasInternet(
{bool force = false, Duration timeout = const Duration(seconds: 5)}) → Future< bool> - Whether the internet (by default: your own API) actually answers. Any HTTP response counts, since a 401 still proves the round trip works. Cached for probeCacheDuration.
-
init(
) → Future< void> -
Starts listening. Idempotent;
initU()calls it for you. -
listen(
void onChange(UNetworkStatus status)) → StreamSubscription< UNetworkStatus> - Same as UNetwork.listen.
-
localIp(
) → Future< String?> - The first non-loopback IPv4 address (the one other devices on the LAN would use).
-
refresh(
) → Future< UNetworkStatus> - Asks the OS again right now, skipping offlineGrace.
-
whenOnline(
{Duration? timeout}) → Future< void> -
Completes as soon as the device is online (immediately if it already is).
Throws TimeoutException after
timeout, when given.