NetUtils class

Constructors

NetUtils()
factory

Properties

connected → bool
是否已连接网络(聚合所有非 none 的 ConnectivityResult,蓝牙也算连接)。
no setter
hashCode → int
The hash code for this object.
no setterinherited
netType → String
当前网络类型文案(如 "wifi" / "移动连接" / "未连接")。
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

applyConnectivityResults(List<ConnectivityResult> results) → void
用一组 ConnectivityResult 同步刷新 _connected/_netType 缓存。
dispose() → void
取消 start 建立的订阅。幂等:未订阅或重复调用均安全。
isConnectedNet({bool reChecked = false}) → Future<bool>
是否连接网络 reChecked 是否需要重新检测
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
start() → void
订阅 Connectivity.onConnectivityChanged 流。
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

isConnectedFromResults(List<ConnectivityResult> results) → bool
Pure connectivity decision extracted from isConnectedNet.