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

HeadersForEachCallback(String value, String key, Headers map) → void

MediaDeviceInfoCallback(List<MediaDeviceInfo> devices) → void

MediaStreamTrackSourcesCallback(List<SourceInfo> sources) → void

MetadataCallback(Metadata metadata) → void

MidiErrorCallback(DomError error) → void

MidiSuccessCallback(MidiAccess access, bool sysex) → 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
htmlBlinkFunctionMap → dynamic

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

getHtmlCreateFunction(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

AnimationEffect

AnimationEvent

AnimationNode

AnimationPlayer

AnimationPlayerEvent

AnimationTimeline

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

BeforeUnloadEvent

Blob

Body

BodyElement

BRElement

ButtonElement

ButtonInputElement

A button, with no default behavior.

CacheStorage

Canvas2DContextAttributes

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

CircularGeofencingRegion

CloseEvent

Comment

CompositionEvent

Console

ConsoleBase

ContentElement

Coordinates

Credential

CredentialsContainer

Crypto

CryptoKey

Css

CssCharsetRule

CssClassSet

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

CssFilterRule

CssFontFaceRule

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

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

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

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

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

InputElement

InputElementBase

Exposes the functionality common between all InputElement types.

InputMethodContext

InstallEvent

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).

KeygenElement

KeyLocation

Defines the standard key locations returned by KeyboardEvent.getKeyLocation.

LabelElement

LegendElement

LIElement

LinkElement

LocalCredential

LocalDateTimeInputElement

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

Location

LocationBase

MapElement

MediaController

MediaDeviceInfo

MediaElement

MediaError

MediaKeyError

MediaKeyEvent

MediaKeyMessageEvent

MediaKeyNeededEvent

MediaKeys

MediaKeySession

MediaList

MediaQueryList

MediaQueryListEvent

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.

Notification

NumberInputElement

A numeric editor control.

ObjectElement

OListElement

OptGroupElement

OptionElement

OutputElement

OverflowEvent

PageTransitionEvent

ParagraphElement

ParamElement

ParentNode

PasswordInputElement

Text with no line breaks (sensitive information).

Path2D

Performance

PerformanceEntry

PerformanceMark

PerformanceMeasure

PerformanceNavigation

PerformanceResourceTiming

PerformanceTiming

PictureElement

Platform

Plugin

PluginArray

PluginPlaceholderElement

Point

A utility class for representing two-dimensional positions.

PopStateEvent

PositionError

PreElement

Presentation

ProcessingInstruction

ProgressElement

ProgressEvent

PushEvent

PushManager

PushRegistration

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.

ReadableStream

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.

ResourceProgressEvent

RtcDataChannel

RtcDataChannelEvent

RtcDtmfSender

RtcDtmfToneChangeEvent

RtcIceCandidate

RtcIceCandidateEvent

RtcPeerConnection

RtcSessionDescription

RtcStatsReport

RtcStatsResponse

Screen

ScreenOrientation

ScriptElement

ScrollAlignment

Options for Element.scrollIntoView.

SearchInputElement

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

SecurityPolicyViolationEvent

SelectElement

Selection

ServiceWorkerClient

ServiceWorkerClients

ServiceWorkerContainer

ServiceWorkerGlobalScope

ServiceWorkerRegistration

ShadowElement

ShadowRoot

SharedWorker

SharedWorkerGlobalScope

SourceBuffer

SourceBufferList

SourceElement

SourceInfo

SpanElement

SpeechGrammar

SpeechGrammarList

SpeechRecognition

SpeechRecognitionAlternative

SpeechRecognitionError

SpeechRecognitionEvent

SpeechRecognitionResult

SpeechSynthesis

SpeechSynthesisEvent

SpeechSynthesisUtterance

SpeechSynthesisVoice

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.

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

Timing

TitleElement

Touch

TouchEvent

TouchList

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

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

WindowEventHandlers

Worker

WorkerConsole

WorkerGlobalScope

WorkerPerformance

XmlDocument

XmlSerializer

XPathEvaluator

XPathExpression

XPathNSResolver

XPathResult

XsltProcessor

Exceptions / Errors

DebugAssertException