This file contains 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.io'; //use this | |
bool connected=false; // and define this global variable. | |
Future<bool> _checkConnectivity() async { | |
bool connect; | |
try { | |
final result = await InternetAddress.lookup('google.com'); | |
if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) { | |
connect = true; |