dvStudioPagePath function

String dvStudioPagePath(
  1. String route
)

The file an exported page belongs in, by the pages router's own rule.

/ is index, a parameter is a bracketed segment, and the file ends .page.dart -- so a page dropped into a project is served at the route it was exported from.

Implementation

String dvStudioPagePath(String route) {
  final List<String> parts = <String>[
    for (final String part in route.split('/'))
      if (part.isNotEmpty)
        part.startsWith(':') ? '[${part.substring(1)}]' : part,
  ];
  if (parts.isEmpty) return 'lib/pages/index.page.dart';
  return 'lib/pages/${parts.join('/')}.page.dart';
}