10 lines
248 B
Dart
10 lines
248 B
Dart
import 'dart:io';
|
|
|
|
Future<bool> hasNetwork() async {
|
|
try {
|
|
final result = await InternetAddress.lookup('example.com');
|
|
return result.isNotEmpty && result[0].rawAddress.isNotEmpty;
|
|
} on SocketException catch (_) {
|
|
return false;
|
|
}
|
|
} |