title: Flutter web HTTP exception Error: XMLHttpRequest error
body: <p>While calling an API (not mine, a 3rd party server), using the <a href="https://pub.dev/packages/http/install" rel="nofollow noreferrer">HTTP package</a>, I get the following error:</p>
  <p>Error: XMLHttpRequest error.</p>
  <p>dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 906:28                get current</p>
  <p>I get this <strong>only when running locally on web</strong>, not with the iOS emulator (works just fine there).</p>
  <p><a href="https://github.com/flutter/flutter/issues/63763" rel="nofollow noreferrer">This</a> didn't help me</p>
  <p>Here's the code:</p>
  <pre><code>try {
    response = await _httpClient.get(
      Uri(
        scheme: 'http',
        host: host,
        path: path,
      ),
      headers: {
        &quot;Access-Control-Allow-Origin&quot;: &quot;*&quot;,
      },
    );
  }
  </code></pre>