<p>If you want to remove the leading hash (#) from the URL of your Flutter web app, you can simply call setPathUrlStrategy in the main function of your app and use url_strategy package.</p> <p>Here is the complete code from main.dart file.</p> <p>color: #4ec9b0;](HomePage(), color: #ce9178;]('/about': (color: #9cdcfe;](context) => color: #4ec9b0;](AboutPage(), }, ); } }</p> <p>color: #569cd6;](class color: #4ec9b0;](HomePage color: #569cd6;](extends color: #4ec9b0;](StatelessWidget { color: #9cdcfe;](@ color: #9cdcfe;](override</p> <p id="ce9178;]('/about');" color:="" color:=>color: #4ec9b0;](Widget color: #dcdcaa;](build(color: #4ec9b0;](BuildContext color: #9cdcfe;](context) { color: #c586c0;](return color: #4ec9b0;](Scaffold( color: #9cdcfe;](appBar: color: #4ec9b0;](AppBar(color: #9cdcfe;](title: color: #4ec9b0;](Text(color: #ce9178;]('Home')), color: #9cdcfe;](body: color: #4ec9b0;](Center( color: #9cdcfe;](child: color: #4ec9b0;](Column( color: #9cdcfe;](mainAxisAlignment: color: #4ec9b0;](MainAxisAlignment.color: #4fc1ff;](center, color: #9cdcfe;](children: [ color: #4ec9b0;](Text(color: #ce9178;]('Welcome to the home page'), color: #4ec9b0;](TextButton( color: #9cdcfe;](child: color: #4ec9b0;](Text(color: #ce9178;]('Go to About page'), color: #9cdcfe;](onPressed: () , ), ], ), ), ); } }</p> <p>color: #569cd6;](class color: #4ec9b0;](AboutPage color: #569cd6;](extends color: #4ec9b0;](StatelessWidget { color: #9cdcfe;](@ color: #9cdcfe;](override</p> <p id="9cdcfe;](context);" color:=>color: #4ec9b0;](Widget color: #dcdcaa;](build(color: #4ec9b0;](BuildContext color: #9cdcfe;](context) { color: #c586c0;](return color: #4ec9b0;](Scaffold( color: #9cdcfe;](appBar: color: #4ec9b0;](AppBar(color: #9cdcfe;](title: color: #4ec9b0;](Text(color: #ce9178;]('About')), color: #9cdcfe;](body: color: #4ec9b0;](Center( color: #9cdcfe;](child: color: #4ec9b0;](Column( color: #9cdcfe;](mainAxisAlignment: color: #4ec9b0;](MainAxisAlignment.color: #4fc1ff;](center, color: #9cdcfe;](children: [ color: #4ec9b0;](Text(color: #ce9178;]('This is the about page'), color: #4ec9b0;](TextButton( color: #9cdcfe;](child: color: #4ec9b0;](Text(color: #ce9178;]('Go back to Home page'), color: #9cdcfe;](onPressed: () , ), ], ), ), ); } } ` Thanks.</p>
Remove # hash from url in flutter web
This Article is posted by seven.srikanth at 1/7/2023 4:29:49 AM
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter
Tags: Flutter web;
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter