Response.movedPermanently constructor

Response.movedPermanently({
  1. required String location,
  2. String? body,
  3. Map<String, Object> headers = const <String, Object>{},
  4. Encoding? encoding,
})

Create a Response Moved Permanently.

This indicates that the requested resource has moved permanently to a new URI. location is that URI. It's automatically set as the Location header in headers.

Implementation

Response.movedPermanently({
  required String location,
  String? body,
  Map<String, Object> headers = const <String, Object>{},
  Encoding? encoding,
}) : this(
        statusCode: 301,
        headers: {
          ...headers,
          'Location': location,
        },
        body: body,
        encoding: encoding,
      );