2

I have set up routes on my MaterialApp like this:

routes: {
          '/': (context) => const Gate(),
          '/ungated': (context) => const LandingPage(gated: false,)
}

it all works fine locally, but when I host it on Firebase hosting and I try to access the /ungated route I get 404 page not found.

also the 404 that I get is not the page I defined in onUnknownRoute: (settings)=> MaterialPageRoute(builder: (_) => _errorRoute(settings))

Any ideas? I feel that I need to change firebase.json but have no idea what to put in there.

EDIT

The problem is because I am using PathUrlStrategy and Firebase Hosting does not work with that. I don't know if it's possible to make it work.

João Abrantes
  • 4,772
  • 4
  • 35
  • 71
  • 2
    You probably need to configure hosting to serve `index.html` for all requests. https://stackoverflow.com/questions/51231060/firebase-hosting-page-not-found-error-on-empty-cache-and-hard-reload – abraham Dec 14 '21 at 02:42

0 Answers0