Getting internet permission in flutter app

4,731

Solution 1

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

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

Solution 2

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.

Share:
4,731
Aashiq
Author by

Aashiq

Myself a very passionate on web-development and Javascript Frameworks,mostly React.Loves to work on cool projects and build great things.Learning through mistakes is my favourite job.

Updated on December 22, 2022

Comments

  • Aashiq
    Aashiq over 1 year

    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?

  • Vega
    Vega almost 3 years
    Please don't copy other's answers. Instead flag for duplicate. stackoverflow.com/a/40458189/5468463
  • Dc7
    Dc7 over 2 years
    What to do in iOS ?
  • hio
    hio over 2 years
    for ios as far as IK there is no need :- stackoverflow.com/questions/61430142/…