prefix method

Router prefix([
  1. String? prefix
])

Implementation

Router prefix([String? prefix]) {
  if (prefix != null) {
    for (final route in _lastAdded) {
      final basePath = route.path.startsWith('/')
          ? route.path.substring(1)
          : route.path;

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