title: Flutter web http Error: XMLHttpRequest error
body: <p>I've been struggling with an http request issue when I try to perform a simple post request to a .net backend. The backend has CORS set up and I've been through many stack overflow posts, trying to solve this issue but it still gives me the same error. Everything works when I test the API on SwaggerUI (same as postman). I don't get it. Is there something I am missing here? Thank you.</p>
  <p>The code:</p>
  <pre><code>import 'dart:convert';
  import 'package:http/http.dart' as http;
  
  abstract class ParentRemoteDataSource {
    Future&lt;void&gt; create({required Map&lt;String, dynamic&gt; parent});
  }
  
  class ParentRemoteDataSourceImpl implements ParentRemoteDataSource {
    final http.Client _client = http.Client();
    final String _url = &quot;http://localhost:5000/api/member/create&quot;;
  
    @override
    Future&lt;void&gt; create({required Map&lt;String, dynamic&gt; parent}) async {
      final Uri uri = Uri.parse(_url);
      final Map&lt;String, String&gt; headers = {&quot;Content-Type&quot;: &quot;application/json&quot;};
  
      final http.Response response = await _client.post(
        uri,
        headers: headers,
        body: jsonEncode(parent),
      );
      print(response.body);
    }
  }
  </code></pre>
  <p>The code above executes at the press of a button on the UI part.
  The error from the post request reads: <code>ERR_CERT_AUTHORITY_INVALID</code>
  , and below that reads: <code>Uncaught (in promise) Error: XMLHttpRequest error.</code></p>