Problem
I wrote an application in Flutter Web. When I run it in the Browser (debug), I get this error:
cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.googleapis.com/identityto...
When I run it in release mode, I just get this:
Error while fetching an original source: NetworkError when attempting to fetch resource.
Source URL: org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_helper.dart
Other info
- The App is hosted in Firebase Hosting but the error also occurs on localhost without Firebase
- I think the Problem is cors in both cases but the release mode just has less logs
What I tried
According to this Documentation or this Question I have to add something using Expressjs like:
const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors({ origin: true }));
- Is there anything like Expressjs in Dart/Flutter? I saw this but I could not get it to work.
- Or is there another way to set the headers?