Skip to content

Instantly share code, notes, and snippets.

View MDSADABWASIM's full-sized avatar
:atom:
Teaching machines

Md Sadab Wasim MDSADABWASIM

:atom:
Teaching machines
View GitHub Profile
@MDSADABWASIM
MDSADABWASIM / connectivity.dart
Created December 27, 2018 13:10
manage connectivity in flutter
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;