lukepighetti / fluro

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
https://pub.dev/packages/fluro
MIT License
3.66k stars 416 forks source link

Flutter web: Refreshing dynamic route opens blank page #276

Open Schloool opened 1 year ago

Schloool commented 1 year ago

I encountered an issue while developing a Flutter Web App using the fluro routing system. In the app it is possible to access an overview of plugins as well as a specific plugin detail page. Therefore a fluro router is set up when starting the app:

void _setupRouter() {
  final router = FluroRouter();

  router.notFoundHandler = Handler(handlerFunc: (c, p) => NotFoundPage());
  router.define('/', handler: Handler(handlerFunc: (c, p) => LandingPage()));
  router.define('/plugins', handler: Handler(handlerFunc: (c, p) => const PluginStorageView()));
  var pluginHandler = Handler(handlerFunc: (c, p) => PluginDetailScreen(storageItemId: p['id']?.first ?? 'unknown'));
  router.define('/plugins/:id', handler: pluginHandler);

  App.router = router;
}

When clicking on an plugin in the overview screen, the detail page is opened using this statement:

App.router.navigateTo(context, '/plugins/${plugin.id}')

All of this works pretty fine opening a webpage looking like this: image

However, when refreshing the page or opening the app at a specified dynamic route such as mywebsite.com/plugins/1234, the website is just white and not a single element of my Material app is loaded: image

Is there any way I can access dynamic routes directly using an URL?

lkrjangid1 commented 1 year ago

I have facing same issue. Did you get any solution of this problem.