flutter access internet storage code example

Example 1: internet permission in flutter

In the AndroidManifest.xml file located at android/app/src/main you need to add this permission inside the manifest tag.

<uses-permission android:name="android.permission.INTERNET"/>

Example 2: 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

Tags:

Dart Example