redirect method

Future<void> redirect(
  1. dynamic url,
  2. {bool absolute = true,
  3. int? code}

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. :)


Future<void> redirect(url, {bool absolute = true, int? code}) {
  if (!isOpen) throw closed();
    ..['content-type'] = 'text/html'
    ..['location'] = (url is String || url is Uri)
        ? url.toString()
        : 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";
  return close();