isConnected static method

Future<bool> isConnected()

判断网络是否连接

Implementation

static Future<bool> isConnected() async {
  var connectResult = await (Connectivity().checkConnectivity());
  return connectResult.isNotEmpty;
}