【问题标题】:flutter web release showing blank screenflutter web release showing blank screen
【发布时间】:2022-12-27 23:00:19
【问题描述】:

I am trying to use release mode of my app. Here are the methods i have tried:

1-I executed flutter clean

2-I executed flutter build web --release

3-I executed flutter run -d chrome --release

On 3rd command it works fine:

But when I open project/build/web/index.html it shows blank screen:

Does anybody know the solution?

【问题讨论】:

    标签: flutter dart flutter-web


    【解决方案1】:

    In index.html you sould see a basehref. The flutter site is displayed only if the base href matches to te domain in which it is hosted. Try hosting it and adding the relevant base href. You can also delete this line and it should work as expected

    【讨论】:

    • I can't run it on localhost?
    • To run in local you just do flutter run -d chrome
    • I used it already, it works. But i am talking about index.html . Doesn't it work independently?
    • No unless you host it i believe
    • To run the release version you can also do flutter run --release
    【解决方案2】:

    Open your web folder with vscode and open index.html, It will show like

    And useLive Serverextension

    And then run by tapping Go live

    【讨论】:

    • I don't use VS.I use Android Studio.
    • This plugin should be available in android studio too
    • Then I think you might need local server like xamp, you can install VS Code, and it is lighter. We aren't just running html but also loading others data
    • I searched,it is not.
    • To run a website, you need server
    【解决方案3】:

    I faced the same thing just now when I open it via Chrome for my first time, and it works after I reopen it.

    so maybe try to reopen it? like what I just did?

    hope this helps.

    【讨论】:

      猜你喜欢
      • 2022-06-14
      • 2021-10-06
      • 1970-01-01
      • 1970-01-01
      • 2022-12-31
      • 1970-01-01
      • 2021-05-28
      • 2020-12-18
      • 1970-01-01
      相关资源
      最近更新 更多