ResponseContext<RawResponse> class abstract

A convenience wrapper around an outgoing HTTP request.

Implemented types
Implementers

Constructors

ResponseContext()

Properties

app ↔ Angel?
The Angel instance that is sending a response.
getter/setter pair
buffer → BytesBuilder?
A set of UTF-8 encoded bytes that will be written to the response.
no setter
chunked ↔ bool?
Is Transfer-Encoding chunked?
getter/setter pair
contentLength ↔ int?
Gets or sets the content length to send back to a client.
getter/setter pair
contentType ↔ MediaType
Gets or sets the content type to send back to a client.
getter/setter pair
cookies → List<Cookie>
Any and all cookies to be sent to the user.
final
correspondingRequest → RequestContext?
Points to the RequestContext corresponding to this response.
no setter
done → Future
Completes once the response is closed (see close), or with the first error passed to addError. Never completes for a detached response.
no setteroverride
encoders → Map<String, Converter<List<int>, List<int>>>
A set of Converter objects that can be used to encode response data.
final
hashCode → int
The hash code for this object.
no setterinherited
hasPendingFinalizers → bool
Whether Angel.responseFinalizers have yet to run for this response.
no setter
headers → CaseInsensitiveMap<String>
Headers that will be sent to the user.
no setter
headersSent → bool
Whether the status and headers have been sent, as by an unbuffered response that has started its body. After that, an error can no longer be answered with an error response: the response is aborted instead.
no setter
isBuffered → bool
Returns true if response data is being written to a buffer, rather than to the underlying stream.
no setter
isOpen → bool
Returns true if the response is still available for processing by Angel.
no setter
properties → Map
final
rawResponse → RawResponse
The underlying RawResponse under this instance.
no setter
renderParams → Map<String, dynamic>
A Map of data to inject when res.render is called.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedEncoder → ({Converter<List<int>, List<int>> encoder, String name})?
The encoder from encoders to apply to this response, chosen by the request's Accept-Encoding header, or null for none.
no setter
serializer ↔ FutureOr<String> Function(dynamic)
Serializes response data into a String.
getter/setter pair
statusCode ↔ int
This response's status code.
getter/setter pair

Methods

abort(Object error, [StackTrace? stackTrace]) → Future<void>
Ends a response whose headersSent after a failure, so that the client sees it fail rather than a complete response: the connection (HTTP/1) or stream (HTTP/2) is closed abruptly. By default, closes it.
add(List<int> event) → void
Adds a data event to the sink.
inherited
addError(Object error, [StackTrace? stackTrace]) → void
Fails done with error. Unless something listens to done, the error is also reported to the current zone (the request's error zone), as nothing else would see it.
override
addStream(Stream<List<int>> stream) → Future
Adds a stream directly the underlying response.
override
close() → Future<void>
Prevents more data from being written to the response, and locks it entire from further editing.
override
detach() → FutureOr<RawResponse>
Signals Angel that the response is being held alive deliberately, and that the framework should not automatically close it.
download(File file, {String? filename}) → Future<void>
Sends a download as a response.
json(Object? value) → Future<bool>
Serializes JSON to the response.
jsonp(Object value, {String callbackName = 'callback', MediaType? contentType}) → Future<void>
Returns a JSONP response.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
redirect(Object? url, {bool absolute = true, int? code}) → Future<void>
Redirects to user to the given URL.
redirectTo(String name, [Map? params, int? code]) → Future<void>
Redirects to the given named Route.
redirectToAction(String action, [Map? params, int? code]) → Future<void>
Redirects to the given Controller action.
render(String view, [Map<String, dynamic>? data]) → Future<void>
Renders a view to the response stream, and closes the response.
runFinalizers([RequestContext? request]) → Future<void>
Runs Angel.responseFinalizers for this response, at most once.
serialize(Object? value, {MediaType? contentType}) → Future<bool>
Serializes data to the response.
streamFile(File file) → Future
Streams a file to this response.
toString() → String
A string representation of this object.
inherited
useBuffer() → void
Configure the response to write to an intermediate response buffer, rather than to the stream directly.
validateHeaders() → void
Throws a 500 AngelHttpException naming any of headers that cannot be sent, after removing them so that the error response can be.
write(Object? value, {Encoding? encoding}) → void
Writes data to the response.
override
writeAll(Iterable objects, [String separator = '']) → void
Writes the elements of objects separated by separator.
override
writeCharCode(int charCode) → void
Writes a string containing the character with code point charCode.
override
writeln([Object? obj = '']) → void
Writes the string representation of object followed by a newline.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

attachmentDisposition(String filename) → String
Builds an attachment Content-Disposition header value for filename (RFC 6266), safe for any name: a quoted ASCII fallback, plus a UTF-8 filename* parameter when the name needs one.
closed() → StateError
isValidHeaderName(String name) → bool
Whether name is a valid HTTP header name (an RFC 9110 token).
isValidHeaderValue(String value) → bool
Whether value can be sent as an HTTP header value: visible ASCII, space and tab, the same rule dart:io enforces.
selectEncoder(Map<String, Converter<List<int>, List<int>>> encoders, String? acceptEncoding) → ({Converter<List<int>, List<int>> encoder, String name})?
Picks the first encoder in encoders named by acceptEncoding, in the client's order, ignoring case. * picks any encoder not rejected with q=0; entries with q=0 are skipped.