title: XMLHttpRequest error with Flutter-Web using Google Places API (firebase hosting)
body: <p>Inside my Flutter-Web application I'm trying to get address using flutter_google_places package. I'm trying simple code to get autocomplete address field (MyTextField is just a customized Text Field):</p>
  
  <pre><code>final addressField = MyTextField(
    controller: _addressController,
    labelText: 'Indirizzo',
    readOnly: true,
    onTap: () async {
      await PlacesAutocomplete.show(
        context: context,
        apiKey: kGoogleApiKey,
        mode: Mode.overlay,
        onError: (error){print('ERROR: $error');},
      );
    },
  );
  </code></pre>
  
  <p>When I run the app and insert something to the field I don't get any result. But I get this error (captured from inspect console on hosting, and I get the same error locally also):</p>
  
  <pre><code>Access to XMLHttpRequest at 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=h&amp;key=**MY-API-KEY**' from origin 'https://**MY-HOSTING**.firebaseapp.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  
  <p>I read that it's a server-side issue and I tried to modify firebase.json like this:</p>
  
  <pre><code>{
    "hosting": {
      "public": "build/web",
      "ignore": [
        "firebase.json",
        "**/.*",
        "**/node_modules/**"
      ],
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ],
      "headers": [ {
        "source" : "**",
        "headers" : [ {
          "key" : "Access-Control-Allow-Origin",
          "value" : "*"
        } ]
      }]
    }
  }
  
  </code></pre>
  
  <p>Deployed that but also got the same error.</p>
  
  <p>Any tips about solving that (locally and on hosting) are appreciated.</p>