CloudflareResponse class final
A Fetch response represented without exposing the host's JavaScript types.
body is null, a String, or a Uint8List. Responses returned by
Durable Object stubs are buffered at this boundary. A response with a
webSocket is a Cloudflare WebSocket upgrade response.
Constructors
-
CloudflareResponse({Object? body, int status = 200, Map<
String, String> headers = const <String, String>{}, CloudflareWebSocket? webSocket}) -
Creates a CloudflareResponse value.
const
-
CloudflareResponse.bytes(Uint8List body, {int status = 200, Map<
String, String> headers = const <String, String>{}}) -
Provides the declared Cloudflare API member.
factory
-
CloudflareResponse.json(Object? value, {int status = 200, Map<
String, String> headers = const <String, String>{}}) -
Provides the declared Cloudflare API member.
factory
-
CloudflareResponse.text(String body, {int status = 200, Map<
String, String> headers = const <String, String>{}}) -
Provides the declared Cloudflare API member.
factory
-
CloudflareResponse.webSocket(CloudflareWebSocket webSocket, {Map<
String, String> headers = const <String, String>{}}) -
Creates a Cloudflare WebSocket upgrade response.
factory
Properties
- body → Object?
-
The body value.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> -
The headers value.
final
- isWebSocketUpgrade → bool
-
The isWebSocketUpgrade value.
no setter
- ok → bool
-
The ok value.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → int
-
The status value.
final
- webSocket → CloudflareWebSocket?
-
The webSocket value.
final
Methods
-
json<
T> ({CloudflareJsonDecoder< T> ? decode}) → T? - Provides the declared Cloudflare API member.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
text(
) → String - Performs the text operation.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited