connectivitySubscription property
Implementation
static StreamSubscription<List<ConnectivityResult>> connectivitySubscription =
Connectivity().onConnectivityChanged.listen((result) {
if (result[0] == ConnectivityResult.mobile) {
netType = "流量";
} else if (result[0] == ConnectivityResult.wifi) {
netType = "WIFI";
} else {
netType = "未连接";
}
AppLog.wtf("网络连接已改变:$netType");
});