statusCode property

  1. @override
int statusCode
override

The status code of the response.

Any integer value is accepted. For the official HTTP status codes use the fields from HttpStatus. If no status code is explicitly set the default value HttpStatus.ok is used.

The status code must be set before the body is written to. Setting the status code after writing to the response body or closing the response will throw a StateError.

Implementation

@override
int get statusCode => origin.statusCode;
  1. @override
void statusCode=(int statusCode)
override

The status code of the response.

Any integer value is accepted. For the official HTTP status codes use the fields from HttpStatus. If no status code is explicitly set the default value HttpStatus.ok is used.

The status code must be set before the body is written to. Setting the status code after writing to the response body or closing the response will throw a StateError.

Implementation

@override
void set statusCode(int statusCode) {
  origin.statusCode = statusCode;
}