title: SocketException: Connection failed (OS Error: Operation not permitted, errno = 1) with flutter app on macOS
body: <p>I have following code in my Flutter app where <code>MyDataLoader</code> is a widget which starts up from <code>main.dart</code></p>
  <p><strong>Code:</strong></p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:http/http.dart' as http;
  
  class MyDataLoader extends StatefulWidget {
    @override
    _MyDataLoaderState createState() =&gt; _MyDataLoaderState();
  }
  
  class _MyDataLoaderState extends State&lt;MyDataLoader&gt; {
    void getData() async {
      final response = await http.get('https://jsonplaceholder.typicode.com/albums/1');
      print(response);
    }
  
    @override
    void initState() {
      super.initState();
      getData();
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Text('MyDataLoader screen'),
      );
    }
  }
  </code></pre>
  <p><strong>Question:</strong><br />
  Above code is inspired from <a href="https://flutter.dev/docs/cookbook/networking/fetch-data" rel="noreferrer">https://flutter.dev/docs/cookbook/networking/fetch-data</a>. I get the following error when <code>MyDataLoader</code> widget loads up:</p>
  <blockquote>
  <p>[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception:
  SocketException: Connection failed (OS Error: Operation not permitted,
  errno = 1), address = jsonplaceholder.typicode.com, port = 443</p>
  </blockquote>
  <p>Above error is of course because of the following line of code called when my widget is loading.</p>
  <blockquote>
  <p>final response = await
  http.get('https://jsonplaceholder.typicode.com/albums/1');</p>
  </blockquote>
  <p><strong>But</strong>, if I open <a href="https://jsonplaceholder.typicode.com/albums/1" rel="noreferrer">https://jsonplaceholder.typicode.com/albums/1</a> on my browser, I am able to to see that it has dummy json which I expect to receive in the response. This means I am well connected to internet.</p>
  <p>I am running my app on <em>macOS Big Sur version 11.1</em>.</p>
  <p>What am I doing wrong? Do I need to <strong>declare some permissions</strong> for my app to be able to access internet from a macOS environment?</p>