Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is HTTP Request on Flutter for MacOS desktop not working on Release?

I’m making a HTTP is debug or profile build, and it works fine. But if I switch to Release it no longer works

 [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: SocketException: Failed host lookup: '*******.*******.*****.io' (OS Error: nodename nor servname provided, or not known, errno = 8)
#0      _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:681)
#1      _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1808)
#2      RawSocket.startConnect (dart:io-patch/socket_patch.dart:27)
#3      RawSecureSocket.startConnect (dart:io/secure_socket.dart:237)
#4      SecureSocket.startConnect (dart:io/secure_socket.dart:60)
#5      _ConnectionTarget.connect (dart:_http/http_impl.dart:2437)
#6      _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2808)
#7      _HttpClient._getConnection (dart:_http/http_impl.dart:2813)

I assume it’s Internet permissions issue, but I can’t find where I need to add permission (info.plist?) and what permissions I need to add?

[✓] Connected device (3 available)
    • iPad Pro (12.9-inch) (5th generation) (mobile) • 00008103-000E44D10C3B001E • ios            • iOS 15.1 19B74
    • macOS (desktop)                                • macos                     • darwin-arm64   • macOS 12.0.1 21A559 darwin-arm
    • Chrome (web)                                   • chrome                    • web-javascript • Google Chrome 96.0.4664.110

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Check this MacOS flutter documentation.

Add the below lines in the macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements:

<key>com.apple.security.network.client</key>
<true/>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading