Response class

The interface of the Fetch API represents the response to a request. You can create a new object using the Response.Response() constructor, but you are more likely to encounter a object being returned as the result of another API operation—for example, a service worker FetchEvent.respondWith, or a simple fetch().

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

Response([dynamic body, ResponseInit? init])
factory

Properties

body ReadableStream?

Available on Body, provided by the PropsBody extension

no setter
bodyUsed bool

Available on Body, provided by the PropsBody extension

no setter
hashCode int
The hash code for this object.
no setterinherited
headers Headers

Available on Response, provided by the PropsResponse extension

no setter
ok bool

Available on Response, provided by the PropsResponse extension

no setter
redirected bool

Available on Response, provided by the PropsResponse extension

no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status int

Available on Response, provided by the PropsResponse extension

no setter
statusText String

Available on Response, provided by the PropsResponse extension

no setter
type ResponseType

Available on Response, provided by the PropsResponse extension

no setter
url String

Available on Response, provided by the PropsResponse extension

no setter

Methods

arrayBuffer() Future<ByteBuffer>

Available on Body, provided by the PropsBody extension

blob() Future<Blob>

Available on Body, provided by the PropsBody extension

clone() Response

Available on Response, provided by the PropsResponse extension

formData() Future<FormData>

Available on Body, provided by the PropsBody extension

json() Future

Available on Body, provided by the PropsBody extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
text() Future<String>

Available on Body, provided by the PropsBody extension

toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

error() Response
json(dynamic data, [ResponseInit? init]) Response
redirect(String url, [int? status = 302]) Response