Search code examples
gitfluttergithubgithub-pagesflutter-web

Nothing appear when I host flutter web app on Github


I want to ask you how I do hosting my flutter web app on Github ,I did all the ways to do that but nothing to show I follow the instructions in this video https://www.youtube.com/watch?v=8hrJ4oN1u_8&list=WL&index=93&t=1s

and everything went fine to pushing to github as you can see

enter image description here

It is a simple page a simple static web page, I don't know what is the wrong, here is the picture of my repo on github

enter image description here

here the link the github provided me https://sunaarun.github.io/demo-hc/ enter image description here

I tried to edit the link to go and display index.html

https://sunaarun.github.io/demo-hc/web/index.html#/

but nothing to show enter image description here

please can anyone help me with this issue


Solution

  • There's a line in index.html in your flutter-web app that needs to know the external path for deployment, and defaults to /. You need to fix that up before committing it to github. It is described in index.html as:

      <!--
        If you are serving your web app in a path other than the root, change the
        href value below to reflect the base path you are serving from.
    
        The path provided below has to start and end with a slash "/" in order for
        it to work correctly.
    
        Fore more details:
        * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
      -->
      <base href="/">
    

    For example, one of my sites has edited that to <base href="/counter/"> and it works fine.