Skip to content

Instantly share code, notes, and snippets.

@ThinkDigitalSoftware
Created May 29, 2018 00:29
Show Gist options
  • Save ThinkDigitalSoftware/9e850f3ca028cafb2657117c5abcf5c0 to your computer and use it in GitHub Desktop.
Save ThinkDigitalSoftware/9e850f3ca028cafb2657117c5abcf5c0 to your computer and use it in GitHub Desktop.
Future example
import 'dart:async';
import 'dart:io';
void main(){
print(imConnected());
}
imConnected() async {
try {
final result = await InternetAddress.lookup('google.com');
if(result.isNotEmpty && result[0].rawAddress.isNotEmpty)
return true;
} on SocketException catch(_) {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment