📜  互联网检测器片段 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:05.188000             🧑  作者: Mango

代码示例1
import 'dart:io';
...
try {
  final result = await InternetAddress.lookup('example.com');
  if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
    print('connected');
  }
} on SocketException catch (_) {
  print('not connected');
}