This Fetch API interface represents the response to a request.
Constructors
- Response.new(Object? body, {int? status, String? statusText, Object? headers})
-
Creates a new Response object.
factory
- Response.error()
-
MDN Reference
factory
- Response.json(Object? data, {int? status, String? statusText, Object? headers})
-
MDN Reference
factory
- Response.raw(Body body, {required int status, required String statusText, ResponseType type, bool redirected, String url})
-
Internal constructor, Creates a new Response object.
factory
- Response.redirect(Object url, [int status])
-
MDN Reference
factory
Properties
-
body
→ Stream<
Uint8List> -
A ReadableStream of the body contents.
no setter
- bodyUsed → bool
-
Stores a boolean value that declares whether the body has been used in a response yet.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- headers → Headers
-
The Headers object associated with the response.
no setter
- ok → bool
-
A boolean indicating whether the response was successful (status in the range 200 – 299) or not.
no setter
- redirected → bool
-
Indicates whether or not the response is the result of a redirect (that is, its URL list has more than one entry).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → int
-
The status code of the response. (This will be 200 for a success).
no setter
- statusText → String
-
The status message corresponding to the status code. (e.g., OK for 200).
no setter
- type → ResponseType
-
The type of the response (e.g., basic, cors).
no setter
- url → String
-
The URL of the response.
no setter
Methods
-
arrayBuffer(
) → Future< Uint8List> - Returns a promise that resolves with an ArrayBuffer representation of the response body.
-
blob(
) → Future< Blob> - Returns a promise that resolves with a Blob representation of the response body.
-
clone(
) → Response - Creates a clone of a Response object.
-
formData(
) → Future< FormData> - Returns a promise that resolves with a FormData representation of the response body.
-
json(
) → Future< Object> - Returns a promise that resolves with the result of parsing the response body text as JSON.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
text(
) → Future< String> - Returns a promise that resolves with a text representation of the response body.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited