skip to Main Content

I want to build web flutter, i use the command "flutter build web".
When I open index.file I get blank screen.

I delete the href from the file.

I open the devTools and saw an error CORS for font.Manifest.json :
(The file created when I do the build)
enter image description here

2

Answers


  1. flutter build web --no-tree-shake-icons --release
    

    Can you try it?

    Login or Signup to reply.
  2. Flutter web generally has Cors problem because the "flutter run web" command is used default Cros configuration of the web browser. But you can change Cors policy when you run Flutter web.

    You can run this command for disabled browser cors problems when you run development;

    flutter run -d chrome --web-browser-flag "--disable-web-security"
    

    Please Do Not Forget
    Your client is not run this command when opening the browser self-computer. You must solve the Cors problem when you publish your app on the server. You must search the Cors policy for your web server configuration.

    Generally, when I use the image source from assets I had this problem many times. And I changed my web server conf. and solved.

    If you want more information about Cors problem of Flutter Web you can check this URL for it: https://github.com/flutter/flutter/pull/104935

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search