XMLHttpRequest class

Use XMLHttpRequest (XHR) objects to interact with servers. You can retrieve data from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing.

MDN Reference

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

Constructors

XMLHttpRequest()
factory

Properties

abort ↔ void Function()

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

getter/setter pair
addEventListener → ({void Function<K$ extends Event>(XMLHttpRequestEventTargetEventMap<K$> type, dynamic listener(K$), [Object? options]) $1, void Function(String type, Object listener, [Object? options]) $2})

Available on XMLHttpRequestEventTarget, provided by the XMLHttpRequestEventTarget$Typings extension

Overload accessor: $1, $2
no setter
addEventListener ↔ void Function(String, [Object?, Object?])

Available on EventTarget, provided by the EventTarget$Typings extension

getter/setter pair
addEventListener → ({void Function<K$>(XMLHttpRequestEventMap<K$> type, dynamic listener(K$), [Object? options]) $1, void Function(String type, Object listener, [Object? options]) $2})

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Overload accessor: $1, $2
no setter
dispatchEvent bool Function(Event)

Available on EventTarget, provided by the EventTarget$Typings extension

getter/setter pair
done num

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

no setter
getAllResponseHeaders String Function()

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

getter/setter pair
getResponseHeader String? Function(String)

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
headersReceived num

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

no setter
loading num

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

no setter
onabort ↔ dynamic Function(ProgressEvent<EventTarget>)?

Available on XMLHttpRequestEventTarget, provided by the XMLHttpRequestEventTarget$Typings extension

getter/setter pair
onerror ↔ dynamic Function(ProgressEvent<EventTarget>)?

Available on XMLHttpRequestEventTarget, provided by the XMLHttpRequestEventTarget$Typings extension

getter/setter pair
onload ↔ dynamic Function(ProgressEvent<EventTarget>)?

Available on XMLHttpRequestEventTarget, provided by the XMLHttpRequestEventTarget$Typings extension

getter/setter pair
onloadend ↔ dynamic Function(ProgressEvent<EventTarget>)?

Available on XMLHttpRequestEventTarget, provided by the XMLHttpRequestEventTarget$Typings extension

getter/setter pair
onloadstart ↔ dynamic Function(ProgressEvent<EventTarget>)?

Available on XMLHttpRequestEventTarget, provided by the XMLHttpRequestEventTarget$Typings extension

getter/setter pair
onprogress ↔ dynamic Function(ProgressEvent<EventTarget>)?

Available on XMLHttpRequestEventTarget, provided by the XMLHttpRequestEventTarget$Typings extension

getter/setter pair
onreadystatechange ↔ dynamic Function(Event)?

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

MDN Reference
getter/setter pair
ontimeout ↔ dynamic Function(ProgressEvent<EventTarget>)?

Available on XMLHttpRequestEventTarget, provided by the XMLHttpRequestEventTarget$Typings extension

getter/setter pair
open → ({void Function(String method, Object url) $1, void Function(String method, Object url, bool async, [String? username, String? password]) $2})

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Overload accessor: $1, $2
no setter
opened num

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

no setter
overrideMimeType ↔ void Function(String)

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

getter/setter pair
readyState num

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Returns client's state.
no setter
removeEventListener → ({void Function<K$ extends Event>(XMLHttpRequestEventTargetEventMap<K$> type, dynamic listener(K$), [Object? options]) $1, void Function(String type, Object listener, [Object? options]) $2})

Available on XMLHttpRequestEventTarget, provided by the XMLHttpRequestEventTarget$Typings extension

Overload accessor: $1, $2
no setter
removeEventListener → ({void Function<K$>(XMLHttpRequestEventMap<K$> type, dynamic listener(K$), [Object? options]) $1, void Function(String type, Object listener, [Object? options]) $2})

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Overload accessor: $1, $2
no setter
removeEventListener ↔ void Function(String, [Object?, Object?])

Available on EventTarget, provided by the EventTarget$Typings extension

getter/setter pair
response → dynamic

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Returns the response body.
no setter
responseText String

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Returns response as text.
no setter
responseType XMLHttpRequestResponseType

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Returns the response type.
getter/setter pair
responseURL String

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

MDN Reference
no setter
responseXML Document?

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Returns the response as document.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
send ↔ void Function([dynamic])

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

getter/setter pair
setRequestHeader ↔ void Function(String, String)

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

getter/setter pair
status num

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

MDN Reference
no setter
statusText String

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

MDN Reference
no setter
timeout num

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Can be set to a time in milliseconds. When set to a non-zero value will cause fetching to terminate after the given time has passed. When the time has passed, the request has not yet completed, and this's synchronous flag is unset, a timeout event will then be dispatched, or a "TimeoutError" DOMException will be thrown otherwise (for the send() method).
getter/setter pair
unsent num

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

no setter
upload XMLHttpRequestUpload

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

Returns the associated XMLHttpRequestUpload object. It can be used to gather transmission information when data is transferred to a server.
no setter
withCredentials bool

Available on XMLHttpRequest, provided by the XMLHttpRequest$Typings extension

True when credentials are to be included in a cross-origin request. False when they are to be excluded in a cross-origin request and when cookies are to be ignored in its response. Initially false.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

done num
no setter
headersReceived num
no setter
loading num
no setter
opened num
no setter
unsent num
no setter