WebConnectivityAdapter class

基于浏览器 navigator.onLine 的 Web 连通性适配器 / Web connectivity adapter backed by the browser's navigator.onLine.

浏览器无法区分 Wi-Fi / 蜂窝等具体传输类型,仅能判断「在线 / 离线」,因此在线时 返回 ['wifi']、离线时返回 ['none'] / Browsers cannot tell Wi-Fi from cellular; they only report online / offline, so the adapter emits ['wifi'] when online and ['none'] when offline.

直接基于 package:web 实现,避免把 connectivity_plus 引入 Web 依赖图,从而保证 包对 WebAssembly(WASM)编译友好 / Implemented directly on top of package:web instead of connectivity_plus so the package stays WASM-compatible (the plugin's Linux-only nm dependency would otherwise leak into the web import graph).

Implemented types

Properties

hashCode int
The hash code for this object.
no setterinherited
onConnectivityChanged Stream<List<String>>
监听连接类型变化 / Emits whenever the transports change.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkConnectivity() Future<List<String>>
读取当前连接类型(如 ['wifi'])/ Reads the current transports, e.g. ['wifi'].
override
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