简体   繁体   中英

Flutter web: blank screen when 'webdev build'

I made a webpage with flutter web. I tested it with the command

webdev serve

I can see the whole website,

But when I want to 'export / save' the website with this command:

webdev build

The webpage is blank, (when I open the html file in the build folder)

[INFO] Reading cached asset graph completed, took 245ms
[INFO] Checking for updates since last build completed, took 806ms
[INFO] Running build completed, took 217ms
[INFO] Caching finalized dependency graph completed, took 148ms
[INFO] Reading manifest at build/.build.manifest completed, took 1ms
[INFO] Deleting previous outputs in `build` completed, took 45ms
[INFO] Creating merged output dir `build` completed, took 226ms
[INFO] Writing asset manifest completed, took 4ms
[INFO] Succeeded after 671ms with 0 outputs (0 actions)

Thanks in advance!

UPDATE:

If I open the html file in the build folder (that gives a blank screen). These are my errors in the console of google chrome:

错误flutterweb

I have a same issue but when I upload live server(host) it worked correctly. I am not sure but it can be about CORS, browser not allowed some source coming from outside of website so in local files has local source that means they are coming from outside the website as browser views. I think you should upload live server or local server.

My flutter web app was displaying a blank page / blank screen too...

Try running the following in the terminal:

  • flutter channel dev
  • flutter upgrade
  • flutter run -d chrome

If it still shows you a blank page (because it's not reaching your local server for some reason) terminate the current server 'ctrl + c'.

Then run flutter run -d web and the terminal will provide you with a new local host url. Follow the link and refresh it once & you should see your app running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM