prefix method

Router prefix([
  1. String? prefix
])

Implementation

Router prefix([String? prefix]) {
  if (prefix != null && _routes.isNotEmpty) {
    final route = _routes.last;
    final basePath =
        route.path.startsWith('/') ? route.path.substring(1) : route.path;

    route.path =
        prefix.endsWith("/") ? "$prefix$basePath" : "$prefix/$basePath";
  }
  return this;
}