flutter Note that connectivity changes are no longer communicated to Android apps in the background starting with Android O. You should always check for connectivity status when your app is resumed. code example
Example: flutter check internet connection
import 'package:connectivity/connectivity.dart';
var connectivityResult = await (Connectivity().checkConnectivity());
if (connectivityResult == ConnectivityResult.mobile) {
// I am connected to a mobile network.
} else if (connectivityResult == ConnectivityResult.wifi) {
// I am connected to a wifi network.
}
//connectivity: any