title: Flutter Web Http Error : Uncaught (in promise) Error: XMLHttpRequest error
body: <p>I am trying to develop a flutter app that sends an http request to a remote php file hosting on 000webHost.</p>
  <p>When I build my Flutter application for Desktop, I manage to retrieve the information, everything is fine. However, due to another problem (video player doesn't work with Desktop....), I want to go back to a web build.</p>
  <p>I have looked on several posts, but I did not find an error similar to mine. Some speak of an error due to Cross Origin Request (CORS), but it does not seem to me to be this problem.</p>
  <p>When I try to retrieve my data with a http.post I have the following errors:</p>
  <pre><code>browser_client.dart:87 POST https://&lt;myadresse&gt;.000webhostapp.com/&lt;nameFile&gt;.php net::ERR_HTTP2_PROTOCOL_ERROR
  </code></pre>
  <pre><code>Uncaught (in promise) Error: XMLHttpRequest error.
      C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 906:28  get current packages/http/src/browser_client.dart 84:22                                                                                    &lt;fn&gt;
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1446:54                                              runUnary
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 150:18                                        handleValue
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 703:44                                        handleValueCallback
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 732:32                                        _propagateToListeners
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/future_impl.dart 526:7                                         [_complete]
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream_pipe.dart 61:11                                         _cancelAndValue
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/stream.dart 1302:7                                             &lt;fn&gt;
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 324:14  _checkAndCall
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 329:39  dcall
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/html/dart2js/html_dart2js.dart 37312:58                              &lt;fn&gt;
  
      at Object.createErrorWithStack (errors.dart:249)
      at Object._rethrow (async_patch.dart:200)
      at async._AsyncCallbackEntry.new.callback (zone.dart:1171)
      at Object._microtaskLoop (schedule_microtask.dart:41)
      at _startMicrotaskLoop (schedule_microtask.dart:50)
      at async_patch.dart:166
  </code></pre>
  <p>My Code :</p>
  <pre><code>
   void fetchData() async {
      /**Map for instructions with php**/
      var map = Map&lt;String, dynamic&gt;();
      HandlerResponse
          handlerResponse2; //Use to manage errors and parsing of received responses
  
      map['action'] = Constants.GET_ALL_OPERATIONS;
  
      try {
        //Retrieving the response with the file containing the accesses to the database
        http.Response responseCall = await http.post(Constants.ROOT,
            body: map, headers: {&quot;Access-Control-Allow-Origin&quot;: &quot;*&quot; , &quot;Access-Control-Allow-Credentials&quot;: &quot;true&quot;});
  
        //Definition of the behavior to adopt upon receipt of the response
        handlerResponse2 = HandlerResponse(parseReponse: parseResponse);
  
        //Recovery of response processing
        _operations =
            handlerResponse2.response(responseCall); //response(responseCall);
  
       
       //Notify the change to widgets using the provider to update the interface
        notifyListeners();
      } on SocketException {
        throw FetchDataException('No Internet connection');
      }
    }
  </code></pre>
  <p>When I use flutter doctor :</p>
  <pre><code>flutter doctor
  Doctor summary (to see all details, run flutter doctor -v):
  [√] Flutter (Channel dev, 1.25.0-4.0.pre, on Microsoft Windows [version 10.0.18362.900], locale fr-FR)
  [√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
  [√] Chrome - develop for the web
  [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.4.5)
  [√] Android Studio (version 4.0)
  [√] Connected device (3 available)
  
  • No issues found!
  </code></pre>
  <p>Thank you in advance for your help</p>