Search code examples
flutterdartflutter-layoutflutter-web

How to hide sub domain from Flutter Web App?


I recently got started creating an app with flutter web. in my experience I am using a named navigator to navigate between pages. whatever name I give to the screen is the name that shows up in my URL.

for example if URL is https://www.example.com and Screen Name is home the URL when I navigate to this screen become https://www.example.com/home.

In my use case I hit an API on the splash screen which gets the contents of the next page and on flutter web if I was to reload my https://www.example.com/home page the screen is blank because it turns everything I got from the API into null.

Is there a way I can hide subdomain? so no matter which page the user is at he/she only sees the main domain https://www.example.com.

any help would be appreciated thanks.

PS: I already used setURLStrategy to remove the # symbol from my sub domains


Solution

  • Have you tried using non-named navigation like

    Navigator.push, Navigator.pop

    Looks like the path appears on the web when you use named routes.