redirect method

void redirect (dynamic url, { bool absolute: true, int code: 302 })

Redirects to user to the given URL.

url can be a String, or a List. If it is a List, a URI will be constructed based on the provided params.

See Router#navigate for more. :)


void redirect(url, {bool absolute: true, int code: 302}) {
  if (!isOpen) throw closed();
    ..['content-type'] = 'text/html'
    ..['location'] = url is String
        ? url
        : app.navigate(url as Iterable, absolute: absolute);
  statusCode = code ?? 302;
  <!DOCTYPE html>
      <meta http-equiv="refresh" content="0; url=$url">
      <h1>Currently redirecting you...</h1>
      <br />
      Click <a href="$url">here</a> if you are not automatically redirected...
        window.location = "$url";