ConnectivityMonitor class
基于 connectivity_plus 的网络链路监视器。
职责:
- 驱动「智能重连」:离线暂停、恢复时立即回调
- 向 UI 抛出瞬时网络类型变更
- 供发送消息做「即时失败判定」
- 供 MediaPolicy 决定流量策略
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isCellular → bool
-
no setter
- isOnline → bool
-
no setter
- isStarted → bool
-
no setter
- isWifi → bool
-
no setter
- networkType → NetworkType
-
no setter
- onNetworkChanged ↔ void Function(NetworkType type)?
-
任意网络类型变化(含 wifi↔mobile)
getter/setter pair
- onNetworkLost ↔ void Function(NetworkType type)?
-
网络从在线 → 离线
getter/setter pair
- onNetworkRestored ↔ void Function(NetworkType type)?
-
网络从离线 → 在线
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
NetworkType> -
no setter
Methods
-
dispose(
) → Future< void> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refresh(
) → Future< NetworkType> - 主动刷新一次(App 从后台回前台时建议调用)
-
start(
) → Future< void> - 启动监听;可重复调用(幂等)
-
stop(
) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → ConnectivityMonitor
-
final