redirectUri method

Future<String> redirectUri(
  1. Uri uri, {
  2. int status = HttpStatus.movedTemporarily,
  3. bool checkApiPath = true,
})

Redirects the response to the given URI.

Sets the HTTP status code for the redirect and performs the redirection. Handles HTTP and HTTPS URLs differently based on the input URI.

uri - The URI to redirect to. status - The HTTP status code to be used for the redirection. Default is 302 (moved temporarily). checkApiPath - A flag indicating whether to prefix the path with /api if it's an API endpoint. Default is true.

Returns a Future<String> with a message indicating the redirection status.

Implementation

Future<String> redirectUri(
  Uri uri, {
  int status = HttpStatus.movedTemporarily,
  bool checkApiPath = true,
}) {
  return redirect(
    uri.toString(),
    status: status,
    checkApiPath: checkApiPath,
  );
}