Flutter web URL navigation like http://localhost:60117/ItemDetails?pId=1 not working


In my flutter project, i have to share a URL which is directly redirect to a particular product details page through social media . so i have added routing-information using velocity_x, my main.dart page is as follows

Widget build(BuildContext context) {
return MaterialApp.router(
  debugShowCheckedModeBanner: false,
  title: 'AppName',
  theme: ThemeData(
      primaryColor: MyAppTheme.primaryColor,
routeInformationParser: VxInformationParser(),
routerDelegate: VxNavigator(routes: {

  "/": (_,__)=> MaterialPage(child:SplashScreen()),
  "/login": (_,__)=> MaterialPage(child:SignUp()),
  "/home": (_,__)=> MaterialPage(child:Home(selectedIndex: 0)),
  "/ItemDetails": (uri, _){
    final pId=int.parse(uri.queryParameters["pId"]);     
    return MaterialPage(
        pId:pId.toString() ,

My Initial route is splash screen and after checking authentication it redirects to login page or home page. when i click on a particular item, creates a url "http://localhost:60117/ItemDetails?pId=1" this. But when i try to launch this url from another tab, first it load product detail page and suddenly redirects to my initial page splashscreen.

I tried to change "/" initial route from "/" to "/splash" and changed my "<base href="/splash/">" but it gives a page not found error initially.

How can i access my product detail page directly using this "http://localhost:60117/ItemDetails?pId=1" URL in correct way.


After long testing i found the answer, here my initial route (‘/’) redirect to the’SplashScreen’. so when i try to access particular item using URL first it comes to SplashScreen and there i coded to redirect to home or Login based on the user authentication. so when i access to a particular item using url it redirect to my login/home. the solution is i changed my initial route to Home page.

Answered By – developer

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *