Skip to content

Flutter web: Refreshing dynamic route opens blank page #276

@Schloool

Description

@Schloool

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions