0

In my Flutter-Web project I need to display my URL without #.

Example: test.com/#/page -> test.com/page

I used html.window.history.pushState(null, "Page", "/page"); for long time and it worked. But things must have had changed and this not results in test.com/page#/page.

I looked into https://github.com/flutter/flutter/issues/3324 but did not find any solution.

Is there any other way to archive this?

2 Answers 2

2

I found a solution which I do not quite understand so if anybody can explain this please edit my answer.

Future.delayed(Duration.zero, () => window.history.pushState(null, "Page", "/page"));

Sign up to request clarification or add additional context in comments.

Comments

0

just use this library. If you want to remove the leading hash (#) from the URL of your Flutter web app,

https://pub.dev/packages/url_strategy

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.