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 ourtutorials—A Game of Darts.

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

  • For even more examples, seeDart HTML5 Sampleson Github.

Typedefs

BlobCallback(Blob blob) → void

@DomName('BlobCallback'), @Experimental()
DatabaseCallback(SqlDatabase database) → void

@DomName('DatabaseCallback'), @Experimental()
EventListener(Event event) → dynamic

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

Emitted for any setlike IDL entry needs a callback signature. Today there is only one.

@DomName('FontFaceSetForEachCallback'), @Experimental()
FrameRequestCallback(num highResTime) → void

@DomName('FrameRequestCallback'), @Experimental()
IdleRequestCallback(IdleDeadline deadline) → void

@DomName('IdleRequestCallback'), @Experimental()
MediaStreamTrackSourcesCallback(List<SourceInfo> sources) → void

@DomName('MediaStreamTrackSourcesCallback'), @Experimental()
MetadataCallback(Metadata metadata) → void

@DomName('MetadataCallback'), @Experimental()
MutationCallback(List<MutationRecord> mutations, MutationObserver observer) → void

@DomName('MutationCallback')
RequestAnimationFrameCallback(num highResTime) → void

@DomName('RequestAnimationFrameCallback')
RtcPeerConnectionErrorCallback(DomException exception) → void

@DomName('RTCPeerConnectionErrorCallback'), @Experimental()
RtcStatsCallback(RtcStatsResponse response) → void

@DomName('RTCStatsCallback'), @Experimental()
ScrollStateCallback(ScrollState scrollState) → void

@DomName('ScrollStateCallback'), @Experimental()
StorageErrorCallback(DomError error) → void

@DomName('StorageErrorCallback'), @Experimental()
StorageQuotaCallback(int grantedQuotaInBytes) → void

@DomName('StorageQuotaCallback'), @Experimental()
StorageUsageCallback(int currentUsageInBytes, int currentQuotaInBytes) → void

@DomName('StorageUsageCallback'), @Experimental()
TimeoutHandler() → void

@DomName('TimeoutHandler')
VoidCallback() → void

@DomName('VoidCallback'), @Experimental()

Properties

document HtmlDocument

Root node for all content in a web page.

read-only
htmlBlinkMap → dynamic

@Deprecated("Internal Use Only"), final
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>

@Deprecated("Internal Use Only")
debug_or_assert(message, expression) → dynamic

@Deprecated("Internal Use Only")
getHtmlCreateType(String key) → dynamic

@Deprecated("Internal Use Only")
query(String relativeSelectors) Element

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

@Experimental()
queryAll(String relativeSelectors) ElementList<Element>

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

@Experimental()
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.

@Experimental()

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

BlobEvent

Body

BodyElement

BRElement

ButtonElement

ButtonInputElement

A button, with no default behavior.

CacheStorage

CalcLength

CanvasCaptureMediaStreamTrack

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

CrossOriginServiceWorkerClient

Crypto

CryptoKey

Css

CssCharsetRule

CssClassSet

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

CssFontFaceRule

CssGroupingRule

CssImportRule

CssKeyframeRule

CssKeyframesRule

CssMediaRule

CssNamespaceRule

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

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

ExtendableMessageEvent

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

IdleDeadline

IFrameElement

ImageBitmap

ImageBitmapRenderingContext

ImageButtonInputElement

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

ImageData

ImageElement

ImmutableListMixin

InjectedScriptHost

InputDeviceCapabilities

InputElement

InputElementBase

Exposes the functionality common between all InputElement types.

InstallEvent

IntersectionObserver

IntersectionObserverEntry

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.

KeywordValue

LabelElement

LegendElement

LengthValue

LIElement

LinkElement

LocalDateTimeInputElement

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

Location

LocationBase

MapElement

Matrix

MediaDeviceInfo

MediaDevices

MediaElement

MediaEncryptedEvent

MediaError

MediaKeyMessageEvent

MediaKeys

MediaKeySession

MediaKeyStatusMap

MediaKeySystemAccess

MediaList

MediaMetadata

MediaQueryList

MediaQueryListEvent

MediaRecorder

MediaSession

MediaSource

MediaStream

MediaStreamEvent

MediaStreamTrack

MediaStreamTrackEvent

MemoryInfo

An HTML

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.

NumberValue

ObjectElement

OffscreenCanvas

OListElement

OptGroupElement

OptionElement

OutputElement

PageTransitionEvent

ParagraphElement

ParamElement

ParentNode

PasswordCredential

PasswordInputElement

Text with no line breaks (sensitive information).

Path2D

Performance

PerformanceCompositeTiming

PerformanceEntry

PerformanceMark

PerformanceMeasure

PerformanceNavigation

PerformanceObserver

PerformanceObserverEntryList

PerformanceRenderTiming

PerformanceResourceTiming

PerformanceTiming

Permissions

PermissionStatus

Perspective

PictureElement

Platform

Plugin

PluginArray

Point

A utility class for representing two-dimensional positions.

PointerEvent

PopStateEvent

PositionError

PositionSensorVRDevice

PositionValue

PreElement

Presentation

PresentationAvailability

PresentationConnection

PresentationConnectionAvailableEvent

PresentationConnectionCloseEvent

PresentationReceiver

PresentationRequest

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

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.

Rotation

RtcCertificate

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

SimpleLength

Skew

SlotElement

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

StorageManager

StorageQuota

StyleElement

StyleMedia

StylePropertyMap

StyleSheet

StyleValue

SubmitButtonInputElement

A button, which when clicked, submits the form.

SyncEvent

SyncManager

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

TransformComponent

TransformValue

TransitionEvent

Translation

TreeWalker

UIEvent

UListElement

UnderlyingSourceBase

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.

UrlSearchParams

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