Search code examples
flutter-webfirebase-hostingflutter-getx

How can I load a specific url page using Firebase Hosting for Flutter Web


I'm using Getx for navigation which internally uses Navigator 2.0. I'm unable to load a specific URL when I Host in Firebase Hosting.

It seems to be working fine locally.

I'm using Url Path Strategy to remove the #


Solution

  • Check if you correctly rewrite all requests to /index.html

    https://firebase.google.com/docs/hosting/full-config

    firebase.json:

    {
      "hosting": {
        "public": "www",
        "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
        "rewrites": [
          {
            "source": "**",
            "destination": "/index.html"
          }
        ]
      },
        ...
    
    

    Deploy again afterwards.