Response class Null safety

An easy-to-use container for responses

Constructors

Response({required Request request, required int statusCode, required ContentType contentType, required Map<String, dynamic> headers, required String body})
Constructor
const
Response.error({required Request request, int statusCode = 501, Map<String, dynamic> headers = const {}, String message = 'This function has not been implemented'})
Generates a non successful response [...]
factory
Response.ok({required Request request, int statusCode = 200, ContentType? contentType, Map<String, dynamic> headers = const {}, String? body})
Generates a successful response
factory

Properties

body String
The body of the response
final
contentType ContentType
The Content-Type of the response body
final
hashCode int
The hash code for this object. [...]
read-only, inherited
headers Map<String, dynamic>
The headers attached to the response
final
request Request
The generating request
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
statusCode int
The resulting HTTP status code
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited