name method

Route name(
  1. String name
)

name the route added last. a group name: is put in front. the same name twice throws a StateError at start.

Route.get('users/{id}', controller).name('users.show');
route('users.show', params: <String, Object>{'id': 5}); // /users/5

Implementation

Route name(String name) {
  RouteData? last = _last;
  if (last == null) {
    throw StateError('Route.name("$name"): there is no route to name.');
  }
  _setName(last, '$_namePrefix$name');
  return this;
}