HTML elements and other resources for web-based applications that need to interact with the browser and the DOM (Document Object Model).

This library includes DOM element types, CSS styling, local storage, media, speech, events, and more. To get started, check out the Element class, the base class for many of the HTML DOM types.

Other resources

  • If you've never written a web app before, try our tutorials—A Game of Darts.

  • To see some web-based Dart apps in action and to play with the code, download Dart Editor and run its built-in examples.

  • For even more examples, see Dart HTML5 Samples on Github.

Typedefs

DatabaseCallback(SqlDatabase database) → void

EventListener(Event event) → dynamic

FontFaceSetForEachCallback(FontFace fontFace, FontFace fontFaceAgain, FontFaceSet set) → void

FrameRequestCallback(num highResTime) → void

MediaStreamTrackSourcesCallback(List<SourceInfo> sources) → void

MetadataCallback(Metadata metadata) → void

MutationCallback(List<MutationRecord> mutations, MutationObserver observer) → void

RequestAnimationFrameCallback(num highResTime) → void

RtcStatsCallback(RtcStatsResponse response) → void

StorageErrorCallback(DomError error) → void

StorageQuotaCallback(int grantedQuotaInBytes) → void

StorageUsageCallback(int currentUsageInBytes, int currentQuotaInBytes) → void

TimeoutHandler() → void

VoidCallback() → void

Properties

document HtmlDocument

Root node for all content in a web page.

read-only
htmlBlinkMap → dynamic

read-only
window Window

Top-level container for a web page, which is usually a browser tab or window.

read-only

Functions

convertNativeObjectToDartMap(JsObject jsObject) Map<String, dynamic>

debug_or_assert(message, expression) → dynamic

getHtmlCreateType(String key) → dynamic

query(String relativeSelectors) Element

Alias for querySelector. Note this function is deprecated because its semantics will be changing in the future.

queryAll(String relativeSelectors) ElementList<Element>

Alias for querySelectorAll. Note this function is deprecated because its semantics will be changing in the future.

querySelector(String selectors) Element

Finds the first descendant element of this document that matches the specified group of selectors.

querySelectorAll(String selectors) ElementList<Element>

Finds all descendant elements of this document that match the specified group of selectors.

spawnDomUri(Uri uri, List<String> args, message) Future<Isolate>

Spawn a DOM isolate using the given URI in the same window. This isolate is not concurrent. It runs on the browser thread with full access to the DOM. Note: this API is still evolving and may move to dart:isolate.

Classes

AbstractWorker

AnchorElement

Animation

AnimationEffectReadOnly

AnimationEffectTiming

AnimationEvent

AnimationPlayerEvent

AnimationTimeline

AppBannerPromptResult

ApplicationCache

ApplicationCache is accessed via Window.applicationCache.

ApplicationCacheErrorEvent

AreaElement

DOM Area Element, which links regions of an image map with a hyperlink.

AudioElement

AudioTrack

AudioTrackList

AutocompleteErrorEvent

BarProp

BaseElement

BatteryManager

BeforeInstallPromptEvent

BeforeUnloadEvent

Blob

Bluetooth

BluetoothDevice

BluetoothGattCharacteristic

BluetoothGattRemoteServer

BluetoothGattService

BluetoothUuid

Body

BodyElement

BRElement

ButtonElement

ButtonInputElement

A button, with no default behavior.

CacheStorage

CanvasElement

CanvasGradient

An opaque canvas object representing a gradient.

CanvasImageSource

An object that can be drawn to a 2D canvas rendering context.

CanvasPattern

An opaque object representing a pattern of image, canvas, or video.

CanvasRenderingContext

CanvasRenderingContext2D

CDataSection

CharacterData

CheckboxInputElement

A boolean editor control.

ChildNode

ChromiumValuebuffer

CircularGeofencingRegion

Client

Clients

ClipboardEvent

CloseEvent

Comment

CompositionEvent

CompositorProxy

CompositorWorker

CompositorWorkerGlobalScope

Console

ConsoleBase

ContentElement

Coordinates

Credential

CredentialsContainer

CrossOriginConnectEvent

CrossOriginServiceWorkerClient

Crypto

CryptoKey

Css

CssCharsetRule

CssClassSet

A Set that stores the CSS class names for an element.

CssFontFaceRule

CssGroupingRule

CssImportRule

CssKeyframeRule

CssKeyframesRule

CssMediaRule

CssPageRule

CssRect

A class for representing CSS dimensions.

CssRule

CssStyleDeclaration

CssStyleDeclarationBase

CssStyleRule

CssStyleSheet

CssSupportsRule

CssViewportRule

CustomEvent

CustomStream

A stream of custom events, which enables the user to "fire" (add) their own custom events to a stream.

DartHtmlDomObject

An abstract class for all DOM objects we wrap in dart:html and related libraries.

DataListElement

DataTransfer

DataTransferItem

DataTransferItemList

DateInputElement

A date (year, month, day) with no time zone.

DedicatedWorkerGlobalScope

DefaultSessionStartEvent

DeprecatedStorageInfo

DeprecatedStorageQuota

DetailsElement

DeviceAcceleration

DeviceLightEvent

DeviceMotionEvent

DeviceOrientationEvent

DeviceRotationRate

DialogElement

Dimension

Class representing a length measurement in CSS.

DirectoryEntry

DirectoryReader

DivElement

A generic container for content on an HTML page; corresponds to the <div> tag.

DListElement

Document

The base class for all documents.

DocumentFragment

DomError

DomException

DomImplementation

DomIterator

DomMatrix

DomMatrixReadOnly

DomParser

DomPoint

DomPointReadOnly

DomRectReadOnly

DomSettableTokenList

DomStringList

DomStringMap

DomTokenList

EffectModel

Element

An abstract class, which all HTML elements extend.

ElementEvents

ElementList

An immutable list containing HTML elements. This list contains some additional methods when compared to regular lists for ease of CSS manipulation on a group of elements.

ElementStream

A specialized Stream available to Elements to enable event delegation.

ElementUpgrader

A utility for changing the Dart wrapper type for elements.

EmailInputElement

An e-mail address or list of e-mail addresses.

EmbedElement

Entry

ErrorEvent

Event

Events

Base class that supports listening for and dispatching browser events.

EventSource

EventStreamProvider

A factory to expose DOM events as Streams.

EventTarget

Base class for all browser objects that support events.

ExtendableEvent

FederatedCredential

FetchEvent

FieldSetElement

File

FileEntry

FileError

FileList

FileReader

FileStream

FileSystem

FileUploadInputElement

A control for picking files from the user's computer.

FileWriter

FixedSizeListIterator

FocusEvent

FontFace

FontFaceSet

FontFaceSetLoadEvent

FormData

FormElement

Gamepad

GamepadButton

GamepadEvent

Geofencing

GeofencingEvent

GeofencingRegion

Geolocation

Geoposition

GlobalEventHandlers

HashChangeEvent

HeadElement

Headers

HeadingElement

HiddenInputElement

Hidden input which is not intended to be seen or edited by the user.

History

HistoryBase

HmdvrDevice

HRElement

An <hr> tag.

HtmlCollection

HtmlDocument

HtmlElement

HtmlFormControlsCollection

HtmlHtmlElement

HtmlOptionsCollection

HttpRequest

A client-side XHR request for getting data from a URL, formally known as XMLHttpRequest.

HttpRequestEventTarget

HttpRequestUpload

IFrameElement

ImageBitmap

ImageButtonInputElement

Either an image which the user can select a coordinate to or a form submit button.

ImageData

ImageElement

ImmutableListMixin

InjectedScriptHost

InputDevice

InputElement

InputElementBase

Exposes the functionality common between all InputElement types.

KeyboardEvent

KeyboardEventStream

Records KeyboardEvents that occur on a particular element, and provides a stream of outgoing KeyEvents with cross-browser consistent keyCode and charCode values despite the fact that a multitude of browsers that have varying keyboard default behavior.

KeyCode

Defines the keycode values for keys that are returned by KeyboardEvent.keyCode.

KeyEvent

A custom KeyboardEvent that attempts to eliminate cross-browser inconsistencies, and also provide both keyCode and charCode information for all key events (when such information can be determined).

KeyframeEffect

KeygenElement

KeyLocation

Defines the standard key locations returned by KeyboardEvent.getKeyLocation.

LabelElement

LegendElement

LIElement

LinkElement

LocalDateTimeInputElement

A date and time (year, month, day, hour, minute, second, fraction of a second) with no time zone.

Location

LocationBase

MapElement

MediaController

MediaDeviceInfo

MediaDevices

MediaElement

MediaEncryptedEvent

MediaError

MediaKeyError

MediaKeyEvent

MediaKeyMessageEvent

MediaKeys

MediaKeySession

MediaKeyStatusMap

MediaKeySystemAccess

MediaList

MediaQueryList

MediaQueryListEvent

MediaSession

MediaSource

MediaStream

MediaStreamEvent

MediaStreamTrack

MediaStreamTrackEvent

MemoryInfo

An HTML <menu> element.

MessageChannel

MessageEvent

MessagePort

Metadata

MetaElement

MeterElement

MidiAccess

MidiConnectionEvent

MidiInput

MidiInputMap

MidiMessageEvent

MidiOutput

MidiOutputMap

MidiPort

MimeType

MimeTypeArray

ModElement

MonthInputElement

A date consisting of a year and a month with no time zone.

MouseEvent

MutationObserver

MutationRecord

NetworkInformation

Node

NodeFilter

NodeIterator

NodeList

NodeTreeSanitizer

Performs sanitization of a node tree after construction to ensure that it does not contain any disallowed elements or attributes.

NodeValidator

Interface used to validate that only accepted elements and attributes are allowed while parsing HTML strings into DOM nodes.

NodeValidatorBuilder

Class which helps construct standard node validation policies.

NonDocumentTypeChildNode

NonElementParentNode

Notification

NotificationEvent

NumberInputElement

A numeric editor control.

ObjectElement

OListElement

OptGroupElement

OptionElement

OutputElement

PageTransitionEvent

ParagraphElement

ParamElement

ParentNode

PasswordCredential

PasswordInputElement

Text with no line breaks (sensitive information).

Path2D

Performance

PerformanceCompositeTiming

PerformanceEntry

PerformanceMark

PerformanceMeasure

PerformanceNavigation

PerformanceRenderTiming

PerformanceResourceTiming

PerformanceTiming

PeriodicSyncEvent

PeriodicSyncManager

PeriodicSyncRegistration

Permissions

PermissionStatus

PictureElement

Platform

Plugin

PluginArray

PluginPlaceholderElement

Point

A utility class for representing two-dimensional positions.

PointerEvent

PopStateEvent

PositionError

PositionSensorVRDevice

PreElement

Presentation

PresentationAvailability

PresentationSession

ProcessingInstruction

ProgressElement

ProgressEvent

PromiseRejectionEvent

PushEvent

PushManager

PushMessageData

PushSubscription

QuoteElement

RadioButtonInputElement

A control that when used with other ReadioButtonInputElement controls forms a radio button group in which only one control can be checked at a time.

Range

RangeInputElement

Similar to NumberInputElement but the browser may provide more optimal styling (such as a slider control).

RangeInputElementBase

Base interface for all input element types which involve ranges.

ReadableByteStream

ReadableByteStreamReader

ReadableStream

ReadableStreamReader

ReadyState

Contains the set of standard values returned by HTMLDocument.getReadyState.

Rectangle

A class for representing two-dimensional rectangles whose properties are immutable.

RelatedEvent

ResetButtonInputElement

A button, which when clicked, resets the form.

RtcDataChannel

RtcDataChannelEvent

RtcDtmfSender

RtcDtmfToneChangeEvent

RtcIceCandidate

RtcIceCandidateEvent

RtcPeerConnection

RtcSessionDescription

RtcStatsReport

RtcStatsResponse

Screen

ScreenOrientation

ScriptElement

ScrollAlignment

Options for Element.scrollIntoView.

ScrollState

SearchInputElement

Similar to TextInputElement, but on platforms where search is styled differently this will get the search style.

SecurityPolicyViolationEvent

SelectElement

Selection

ServicePort

ServicePortCollection

ServicePortConnectEvent

ServiceWorkerContainer

ServiceWorkerGlobalScope

ServiceWorkerMessageEvent

ServiceWorkerRegistration

ShadowElement

ShadowRoot

SharedArrayBuffer

SharedWorker

SharedWorkerGlobalScope

SourceBuffer

SourceBufferList

SourceElement

SourceInfo

SpanElement

SpeechGrammar

SpeechGrammarList

SpeechRecognition

SpeechRecognitionAlternative

SpeechRecognitionError

SpeechRecognitionEvent

SpeechRecognitionResult

SpeechSynthesis

SpeechSynthesisEvent

SpeechSynthesisUtterance

SpeechSynthesisVoice

StashedMessagePort

StashedPortCollection

Storage

The type used by the Window.localStorage and Window.sessionStorage properties. Storage is implemented as a Map<String, String>.

StorageEvent

StorageInfo

StorageQuota

StyleElement

StyleMedia

StyleSheet

SubmitButtonInputElement

A button, which when clicked, submits the form.

SyncEvent

SyncManager

SyncRegistration

TableCaptionElement

TableCellElement

TableColElement

TableElement

TableRowElement

TableSectionElement

TelephoneInputElement

Represents a control for editing a telephone number.

TemplateElement

Text

TextAreaElement

TextEvent

TextInputElement

A basic text input editor control.

TextInputElementBase

Base interface for all inputs which involve text editing.

TextMetrics

TextTrack

TextTrackCue

TextTrackCueList

TextTrackList

TimeInputElement

A time (hour, minute, seconds, fractional seconds) with no time zone.

TimeRanges

TitleElement

Touch

TouchEvent

TouchList

TrackDefault

TrackDefaultList

TrackElement

TrackEvent

TransitionEvent

TreeWalker

UIEvent

UListElement

UnknownElement

UriPolicy

Defines the policy for what types of uris are allowed for particular attribute values.

Url

UrlInputElement

A control for editing an absolute URL.

UrlUtils

UrlUtilsReadOnly

ValidityState

VideoElement

VideoPlaybackQuality

VideoTrack

VideoTrackList

VRDevice

VREyeParameters

VRFieldOfView

VRPositionState

VttCue

VttRegion

VttRegionList

WebSocket

Use the WebSocket interface to connect to a WebSocket, and to send and receive data on that WebSocket.

WeekInputElement

A date consisting of a week-year number and a week number with no time zone.

WheelEvent

Window

Top-level container for the current browser tab or window.

WindowBase

Top-level container for a browser tab or window.

WindowBase64

WindowClient

WindowEventHandlers

Worker

WorkerConsole

WorkerGlobalScope

WorkerPerformance

XmlDocument

XmlSerializer

XPathEvaluator

XPathExpression

XPathNSResolver

XPathResult

XsltProcessor

Exceptions / Errors

DebugAssertException