The problem was in Google Cloud's CORS, try setting cors.json to the following code:
[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
I had difficulty changing CORS, directly in the Google Cloud console it didn't work, I had to download a tool called firebase admin, create a node project, download the json key from my firebase and run this code:
const admin = require('firebase-admin');
// Inicialize o Firebase Admin SDK com a chave privada
const serviceAccount = require('./comprasnozapkey.json'); // Substitua pelo nome do seu arquivo de chave
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
storageBucket: 'gs://yourbucket', // Substitua pelo nome do seu bucket
});
const bucket = admin.storage().bucket();
const corsConfig = [
{
origin: ['*'], // Substitua "*" pelo domínio do seu app para maior segurança
method: ['GET'],
maxAgeSeconds: 3600,
},
];
bucket.setCorsConfiguration(corsConfig)
.then(() => {
console.log('Configuração de CORS aplicada com sucesso!');
})
.catch((err) => {
console.error('Erro ao configurar CORS:', err);
});
you have to have node npm, you have to have firebase sdk and firebase admin sdk.
I don't remember exactly what the commands were but I remember that I just ran this code. Another quick but not recommended alternative that I found was to use the HTML renderer, but it is slow and not worth it for anyone who is actually creating a website, just for testing, etc. To use the renderer, just use this command in the terminal:
for run:
flutter run -d chrome --web-renderer html
for build:
flutter build web --release --web-renderer=html
Translate the commented lines into Brazilian Portuguese, as I am Brazilian, thanks