Created
May 29, 2018 00:29
-
-
Save ThinkDigitalSoftware/9e850f3ca028cafb2657117c5abcf5c0 to your computer and use it in GitHub Desktop.
Future example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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