K.Os
K.Os

Reputation: 5506

How to enable Flutter internet permission for macos desktop app?

I am trying to develop Flutter app which will run also on destkop. This app is using http package:

import 'package:http/http.dart'

When I am trying to perform http request I am getting this exception:

 SocketException: Connection failed (OS Error: Operation not permitted, errno = 1), address = firebasedynamiclinks.googleapis.com, port = 443

This app is working on Android and iOS, how to enable this permission for macos?

I am using IntelliJ IDE, so this answer is not satisfying me Flutter - http.get fails on macos build target: Connection failed

Upvotes: 53

Views: 26479

Answers (3)

smorgan
smorgan

Reputation: 21599

You need to add:

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

to macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements.

This is documented here.

Upvotes: 155

Bilal
Bilal

Reputation: 66

add:

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

to Locations in your project macos/Runner/DebugProfile.entitlements also to macos/Runner/Release.entitlements.

After adding this, do flutter clean your project. and rebuild it.

Then, You would likely not face below issue.

"Outgoing Connections (Client)" permission to project via Xcode.

Upvotes: 2

Payam Zahedi
Payam Zahedi

Reputation: 855

you should give "Outgoing Connections (Client)" permission to your project through Xcode. for a complete explanation check this link.

Upvotes: 1

Related Questions