baseRoutePath function

String? baseRoutePath(
  1. Context c
)

Returns the group prefix pattern of the matched route.

When routes are registered through Darto.group or Router.group, the prefix is preserved as a pattern (param names are not resolved).

final api = app.group('/api');
api.get('/users/:id', (c) {
  print(baseRoutePath(c)); // '/api'
  return c.text('ok');
});

final sub = app.group('/:tenant');
sub.get('/data', (c) {
  print(baseRoutePath(c)); // '/:tenant'
  return c.text('ok');
});

Implementation

String? baseRoutePath(Context c) => c.baseRoutePath;