statusCode property

int statusCode
read / write

Gets and sets the status code. 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.

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-io/HttpResponse/statusCode.html