Getting internet permission in flutter app

Viewed 8447

I'm new to flutter and I'm in a situation to get internet permission for our flutter app which we are developing, we've used enter link description here for handling permissions. We also accessed microphone permission and it worked well. but can't get the internet permission request.

And I want to know whether internet permission(But I've mentioned in the Manifest.xml file) is not mandatory or not?

3 Answers

just write this in your Anroidmanifest.xml in android module in flutter project:

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

Internet permissions are required for macOS in addition to Android so I'm adding an expanded answer.

Android

Add the following line in your AndroidManifest.xml file before the <application> section:

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

See also the Flutter docs for creating an Android release.

macOS

Add the following key-value pair to macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements:

<key>com.apple.security.network.client</key>
<true/>

See also the Desktop support for Flutter documentation.

It can be a better solution . Paste the code below to android manifest.xml

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

uses-permission
   android:name="android.permission.ACCESS_NETWORK_STATE"
Related