routes function

List<GoRoute> routes()

routes for the developer feature

Implementation

List<GoRoute> routes() {
  return [
    GoRoute(
      path: '/developer',
      redirect: (context, state) {
        if (state.matchedLocation == state.fullPath) {
          return '/developer/list';
        }

        return state.uri.path;
      },
      routes: [
        GoRoute(
          path: 'list',
          builder: (context, state) => const PluginAndFeatureList(),
        ),
        GoRoute(
          path: 'playground',
          builder: (context, state) => const ContentPlayground(),
        ),
        GoRoute(
          path: 'features/:name',
          builder: (context, state) => FeatureDetail(
            feature: vyuh.features.firstWhere(
              (element) => element.name == state.pathParameters['name'],
            ),
          ),
        ),
        GoRoute(
          path: 'plugins/:name',
          builder: (context, state) {
            final plugin = vyuh.plugins.firstWhere(
              (element) => element.name == state.pathParameters['name'],
            );

            return plugin.detailsView(context);
          },
        ),
        GoRoute(
          path: 'extensions/content',
          builder: (context, state) => ContentExtensionDetail(
            extension: state.extra as ContentExtensionDescriptor,
          ),
        ),
      ],
    ),
  ];
}