December 17, 2024 by Toyin Ajani
Connection failed (OS Error: Operation not permitted, errno = 1) - Flutter
If you have come across this exact error in flutter when attempting to display an image in your flutter app (macOS desktop) then do not fret because the resolution for this is actually very simple. It is described as the most upvoted answer on stack-overflow here:
However, if you’d like a more step-by-step guide then you can also follow this.
This is the error you will be encountering, likely with a different address:
As per the stack-overflow answer:
macOS needs you to request a specific entitlement in order to access the network.
To do that, first open Xcode by running this command in a termial: open macos/Runner.xcworkspace
which should open XCode for you:
Now inside Release.entitlements Click on the “+” to add a new row.
- Paste in com.apple.security.network.client as the key
- Click enter and this should auto-change to “Outgoing Network Connections”
- Then change the Value to YES (can just type true and it’ll change automatically)
Do the same thing in DebugProfile.entitlements
Now just restart your flutter app and the image should display with no problems.
Hopefully that helps because I was struggling for a little bit finding the resolution.
Peace and Blessings