HttpResponse class
HTTP-like response
Constructors
-
HttpResponse.new({required HttpStatus status, String version = 'HTTP/1.1', Map<
String, String> ? headers, Uint8List? body}) - HttpResponse.error(HttpStatus status, [String? message])
-
Create an error response
factory
-
HttpResponse.json(Map<
String, dynamic> data, {HttpStatus status = HttpStatus.ok}) -
Create a successful response with JSON body
factory
- HttpResponse.text(String text, {HttpStatus status = HttpStatus.ok})
-
Create a successful response with text body
factory
Properties
- body → Uint8List?
-
final
-
bodyAsJson
→ Map<
String, dynamic> ? -
Get body as JSON
no setter
- bodyAsString → String?
-
Get body as string (assumes UTF-8 encoding)
no setter
- contentLength → int
-
Get content length from headers or body
no setter
- contentType → String
-
Get content type from headers
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → HttpStatus
-
final
- version → String
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
serialize(
) → Uint8List - Serialize response to wire format
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
parse(
Uint8List data) → HttpResponse - Parse response from wire format