checking internet connectivity flutter apps

PHOTO EMBED

Fri Dec 11 2020 13:38:42 GMT+0000 (UTC)

Saved by @Kenana #dart

try {
      final result = await InternetAddress.lookup('google.com');
      if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
          print(' connected');
      }
    } on SocketException catch (_) {
      //NOT connected to the internet
      print('not connected');
    }
content_copyCOPY