isConnectedToWiFi function

Future<bool> isConnectedToWiFi()

判断设备是否连接WiFi

Implementation

Future<bool> isConnectedToWiFi() async {
  var connectivityResult = await Connectivity().checkConnectivity();
  return connectivityResult.contains(ConnectivityResult.wifi);
}