redirectTo method

void redirectTo({
  1. String path = "/",
})

Redirects the client to the provided path.

If the path cannot be parsed, the request falls back to a home-page redirect.

Example:

request.redirectTo(path: '/posts');

Implementation

void redirectTo({String path = "/"}) {
  try {
    response.redirect(Uri.parse(path));
    response.close();
  } catch (e) {
    redirectHome();
  }
}