Appearance
Window ​
class Window extends EventTarget implements GlobalEventHandlers, WindowBase64, WindowEventHandlers, WindowBaseAnnotations: @Native.new("Window,DOMWindow")
Top-level container for the current browser tab or window.
In a web browser, each window has a Window object, but within the context of a script, this object represents only the current window. Each other window, tab, and iframe has its own Window object.
Each window contains a Document object, which contains all of the window's content.
Use the top-level window object to access the current window. For example:
dart
// Draw a scene when the window repaints.
drawScene(num delta) {...}
window.animationFrame.then(drawScene);.
// Write to the console.
window.console.log('Jinkies!');
window.console.error('Jeepers!');Note: This class represents only the current window, while WindowBase is a representation of any window, including other tabs, windows, and frames.
See also ​
Other resources ​
- DOM Window from MDN.
- Window from the W3C.
Inheritance
Object → EventTarget → Window
Implemented types
Properties ​
animationFrame no setter ​
Returns a Future that completes just before the window is about to repaint so the user can draw an animation frame.
If you need to later cancel this animation, use requestAnimationFrame instead.
The Future completes to a timestamp that represents a floating point value of the number of milliseconds that have elapsed since the page started to load (which is also the timestamp at this call to animationFrame).
Note: The code that runs when the future completes should call animationFrame again for the animation to continue.
Implementation
dart
Future<num> get animationFrame {
var completer = new Completer<num>.sync();
requestAnimationFrame((time) {
completer.complete(time);
});
return completer.future;
}animationWorklet no setter ​
_Worklet? get animationWorkletImplementation
dart
_Worklet? get animationWorklet native;applicationCache no setter ​
ApplicationCache? get applicationCacheThe application cache for this window.
Other resources ​
- A beginner's guide to using the application cache from HTML5Rocks.
- Application cache API from WHATWG.
Implementation
dart
ApplicationCache? get applicationCache native;audioWorklet no setter ​
_Worklet? get audioWorkletImplementation
dart
_Worklet? get audioWorklet native;caches no setter ​
CacheStorage? get cachesImplementation
dart
CacheStorage? get caches native;closed no setter override ​
bool? get closedIndicates whether this window has been closed.
dart
print(window.closed); // 'false'
window.close();
print(window.closed); // 'true'MDN does not have compatibility info on this attribute, and therefore is marked nullable.
Implementation
dart
bool? get closed native;console no setter ​
Console get consoleThe debugging console for this window.
Implementation
dart
Console get console => Console._safeConsole;cookieStore no setter ​
CookieStore? get cookieStoreImplementation
dart
CookieStore? get cookieStore native;crypto no setter ​
Crypto? get cryptoEntrypoint for the browser's cryptographic functions.
Other resources ​
- Web cryptography API from W3C.
Implementation
dart
Crypto? get crypto native;customElements no setter ​
CustomElementRegistry? get customElementsImplementation
dart
CustomElementRegistry? get customElements native;defaultStatus read / write ​
String? get defaultStatusDeprecated.
Implementation
dart
String? get defaultStatus native;
set defaultStatus(String? value) native;defaultstatus read / write ​
String? get defaultstatusDeprecated.
Implementation
dart
String? get defaultstatus native;
set defaultstatus(String? value) native;devicePixelRatio no setter ​
num get devicePixelRatioThe ratio between physical pixels and logical CSS pixels.
Other resources ​
- devicePixelRatio from quirksmode.
- More about devicePixelRatio from quirksmode.
Implementation
dart
num get devicePixelRatio native;document no setter ​
Document get documentThe newest document in this window.
Other resources ​
- Loading web pages from WHATWG.
Implementation
dart
Document get document => JS('Document', '#.document', this);external no setter ​
External? get externalImplementation
dart
External? get external native;hashCode no setter inherited ​
int get hashCodeInherited from Interceptor.
Implementation
dart
int get hashCode => Primitives.objectHashCode(this);history no setter override ​
History get historyThe current session history for this window's newest document.
Other resources ​
- Loading web pages from WHATWG.
Implementation
dart
History get history native;indexedDB no setter ​
IdbFactory? get indexedDBGets an instance of the Indexed DB factory to being using Indexed DB.
Use dart:indexed_db.IdbFactory.supported to check if Indexed DB is supported on the current platform.
Implementation
dart
@SupportedBrowser(SupportedBrowser.CHROME, '23.0')
@SupportedBrowser(SupportedBrowser.FIREFOX, '15.0')
@SupportedBrowser(SupportedBrowser.IE, '10.0')
IdbFactory? get indexedDB => JS(
'IdbFactory|Null', // If not supported, returns null.
'#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB',
this,
this,
this,
);innerHeight no setter ​
int? get innerHeightThe height of the viewport including scrollbars.
Other resources ​
- Window.innerHeight from MDN.
Implementation
dart
int? get innerHeight native;innerWidth no setter ​
int? get innerWidthThe width of the viewport including scrollbars.
Other resources ​
- Window.innerWidth from MDN.
Implementation
dart
int? get innerWidth native;isSecureContext no setter ​
bool? get isSecureContextImplementation
dart
bool? get isSecureContext native;localStorage no setter ​
Storage get localStorageStorage for this window that persists across sessions.
Other resources ​
- DOM storage guide from MDN.
- The past, present & future of local storage for web applications from Dive Into HTML5.
- Local storage specification from W3C.
Implementation
dart
Storage get localStorage native;location read / write override-getter ​
Location get locationgetter:
The current location of this window.
dart
Location currentLocation = window.location;
print(currentLocation.href); // 'http://www.example.com:80/'setter:
Sets the window's location, which causes the browser to navigate to the new location.
Implementation
dart
Location get location => _location;
set location(value) {
_location = value;
}locationbar no setter ​
BarProp? get locationbarThis window's location bar, which displays the URL.
Other resources ​
- Browser interface elements from WHATWG.
Implementation
dart
BarProp? get locationbar native;menubar no setter ​
BarProp? get menubarThis window's menu bar, which displays menu commands.
Other resources ​
- Browser interface elements from WHATWG.
Implementation
dart
BarProp? get menubar native;name read / write ​
String? get nameThe name of this window.
Other resources ​
- Window.name from MDN.
Implementation
dart
String? get name native;
set name(String? value) native;navigator no setter ​
Navigator get navigatorThe user agent accessing this window.
Other resources ​
- The navigator object from WHATWG.
Implementation
dart
Navigator get navigator native;offscreenBuffering no setter ​
bool? get offscreenBufferingWhether objects are drawn offscreen before being displayed.
Other resources ​
- offscreenBuffering from WebPlatform.org.
Implementation
dart
bool? get offscreenBuffering native;on no setter inherited ​
Events get onThis is an ease-of-use accessor for event streams which should only be used when an explicit accessor is not available.
Inherited from EventTarget.
Implementation
dart
Events get on => new Events(this);onAbort no setter override ​
Stream of abort events handled by this Window.
Implementation
dart
Stream<Event> get onAbort => Element.abortEvent.forTarget(this);onAnimationEnd no setter ​
Stream<AnimationEvent> get onAnimationEndStream of animationend events handled by this Window.
Implementation
dart
Stream<AnimationEvent> get onAnimationEnd =>
animationEndEvent.forTarget(this);onAnimationIteration no setter ​
Stream<AnimationEvent> get onAnimationIterationStream of animationiteration events handled by this Window.
Implementation
dart
Stream<AnimationEvent> get onAnimationIteration =>
animationIterationEvent.forTarget(this);onAnimationStart no setter ​
Stream<AnimationEvent> get onAnimationStartStream of animationstart events handled by this Window.
Implementation
dart
Stream<AnimationEvent> get onAnimationStart =>
animationStartEvent.forTarget(this);onBeforeUnload no setter ​
Stream of beforeunload events handled by this Window.
Implementation
dart
Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this);onBlur no setter override ​
Stream of blur events handled by this Window.
Implementation
dart
Stream<Event> get onBlur => Element.blurEvent.forTarget(this);onCanPlay no setter override ​
Implementation
dart
Stream<Event> get onCanPlay => Element.canPlayEvent.forTarget(this);onCanPlayThrough no setter override ​
Implementation
dart
Stream<Event> get onCanPlayThrough =>
Element.canPlayThroughEvent.forTarget(this);onChange no setter override ​
Stream of change events handled by this Window.
Implementation
dart
Stream<Event> get onChange => Element.changeEvent.forTarget(this);onClick no setter override ​
Stream<MouseEvent> get onClickStream of click events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onClick => Element.clickEvent.forTarget(this);onContentLoaded no setter ​
Stream of contentloaded events handled by this Window.
Implementation
dart
Stream<Event> get onContentLoaded => contentLoadedEvent.forTarget(this);onContextMenu no setter override ​
Stream<MouseEvent> get onContextMenuStream of contextmenu events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onContextMenu =>
Element.contextMenuEvent.forTarget(this);onDeviceMotion no setter ​
Stream<DeviceMotionEvent> get onDeviceMotionStream of devicemotion events handled by this Window.
Implementation
dart
Stream<DeviceMotionEvent> get onDeviceMotion =>
deviceMotionEvent.forTarget(this);onDeviceOrientation no setter ​
Stream<DeviceOrientationEvent> get onDeviceOrientationStream of deviceorientation events handled by this Window.
Implementation
dart
Stream<DeviceOrientationEvent> get onDeviceOrientation =>
deviceOrientationEvent.forTarget(this);onDoubleClick no setter override ​
Stream of doubleclick events handled by this Window.
Implementation
dart
@DomName('Window.ondblclick')
Stream<Event> get onDoubleClick => Element.doubleClickEvent.forTarget(this);onDrag no setter override ​
Stream<MouseEvent> get onDragStream of drag events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onDrag => Element.dragEvent.forTarget(this);onDragEnd no setter override ​
Stream<MouseEvent> get onDragEndStream of dragend events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onDragEnd => Element.dragEndEvent.forTarget(this);onDragEnter no setter override ​
Stream<MouseEvent> get onDragEnterStream of dragenter events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onDragEnter => Element.dragEnterEvent.forTarget(this);onDragLeave no setter override ​
Stream<MouseEvent> get onDragLeaveStream of dragleave events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onDragLeave => Element.dragLeaveEvent.forTarget(this);onDragOver no setter override ​
Stream<MouseEvent> get onDragOverStream of dragover events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onDragOver => Element.dragOverEvent.forTarget(this);onDragStart no setter override ​
Stream<MouseEvent> get onDragStartStream of dragstart events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onDragStart => Element.dragStartEvent.forTarget(this);onDrop no setter override ​
Stream<MouseEvent> get onDropStream of drop events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onDrop => Element.dropEvent.forTarget(this);onDurationChange no setter override ​
Implementation
dart
Stream<Event> get onDurationChange =>
Element.durationChangeEvent.forTarget(this);onEmptied no setter override ​
Implementation
dart
Stream<Event> get onEmptied => Element.emptiedEvent.forTarget(this);onEnded no setter override ​
Implementation
dart
Stream<Event> get onEnded => Element.endedEvent.forTarget(this);onError no setter override ​
Stream of error events handled by this Window.
Implementation
dart
Stream<Event> get onError => Element.errorEvent.forTarget(this);onFocus no setter override ​
Stream of focus events handled by this Window.
Implementation
dart
Stream<Event> get onFocus => Element.focusEvent.forTarget(this);onHashChange no setter override ​
Stream of hashchange events handled by this Window.
Implementation
dart
Stream<Event> get onHashChange => hashChangeEvent.forTarget(this);onInput no setter override ​
Stream of input events handled by this Window.
Implementation
dart
Stream<Event> get onInput => Element.inputEvent.forTarget(this);onInvalid no setter override ​
Stream of invalid events handled by this Window.
Implementation
dart
Stream<Event> get onInvalid => Element.invalidEvent.forTarget(this);onKeyDown no setter override ​
Stream<KeyboardEvent> get onKeyDownStream of keydown events handled by this Window.
Implementation
dart
Stream<KeyboardEvent> get onKeyDown => Element.keyDownEvent.forTarget(this);onKeyPress no setter override ​
Stream<KeyboardEvent> get onKeyPressStream of keypress events handled by this Window.
Implementation
dart
Stream<KeyboardEvent> get onKeyPress => Element.keyPressEvent.forTarget(this);onKeyUp no setter override ​
Stream<KeyboardEvent> get onKeyUpStream of keyup events handled by this Window.
Implementation
dart
Stream<KeyboardEvent> get onKeyUp => Element.keyUpEvent.forTarget(this);onLoad no setter override ​
Stream of load events handled by this Window.
Implementation
dart
Stream<Event> get onLoad => Element.loadEvent.forTarget(this);onLoadedData no setter override ​
Implementation
dart
Stream<Event> get onLoadedData => Element.loadedDataEvent.forTarget(this);onLoadedMetadata no setter override ​
Implementation
dart
Stream<Event> get onLoadedMetadata =>
Element.loadedMetadataEvent.forTarget(this);onLoadStart no setter ​
Implementation
dart
Stream<Event> get onLoadStart => loadStartEvent.forTarget(this);onMessage no setter override ​
Stream<MessageEvent> get onMessageStream of message events handled by this Window.
Implementation
dart
Stream<MessageEvent> get onMessage => messageEvent.forTarget(this);onMouseDown no setter override ​
Stream<MouseEvent> get onMouseDownStream of mousedown events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onMouseDown => Element.mouseDownEvent.forTarget(this);onMouseEnter no setter override ​
Stream<MouseEvent> get onMouseEnterStream of mouseenter events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onMouseEnter =>
Element.mouseEnterEvent.forTarget(this);onMouseLeave no setter override ​
Stream<MouseEvent> get onMouseLeaveStream of mouseleave events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onMouseLeave =>
Element.mouseLeaveEvent.forTarget(this);onMouseMove no setter override ​
Stream<MouseEvent> get onMouseMoveStream of mousemove events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onMouseMove => Element.mouseMoveEvent.forTarget(this);onMouseOut no setter override ​
Stream<MouseEvent> get onMouseOutStream of mouseout events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onMouseOut => Element.mouseOutEvent.forTarget(this);onMouseOver no setter override ​
Stream<MouseEvent> get onMouseOverStream of mouseover events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onMouseOver => Element.mouseOverEvent.forTarget(this);onMouseUp no setter override ​
Stream<MouseEvent> get onMouseUpStream of mouseup events handled by this Window.
Implementation
dart
Stream<MouseEvent> get onMouseUp => Element.mouseUpEvent.forTarget(this);onMouseWheel no setter override ​
Stream<WheelEvent> get onMouseWheelStream of mousewheel events handled by this Window.
Implementation
dart
Stream<WheelEvent> get onMouseWheel =>
Element.mouseWheelEvent.forTarget(this);onOffline no setter override ​
Stream of offline events handled by this Window.
Implementation
dart
Stream<Event> get onOffline => offlineEvent.forTarget(this);onOnline no setter override ​
Stream of online events handled by this Window.
Implementation
dart
Stream<Event> get onOnline => onlineEvent.forTarget(this);onPageHide no setter ​
Stream of pagehide events handled by this Window.
Implementation
dart
Stream<Event> get onPageHide => pageHideEvent.forTarget(this);onPageShow no setter ​
Stream of pageshow events handled by this Window.
Implementation
dart
Stream<Event> get onPageShow => pageShowEvent.forTarget(this);onPause no setter override ​
Implementation
dart
Stream<Event> get onPause => Element.pauseEvent.forTarget(this);onPlay no setter override ​
Implementation
dart
Stream<Event> get onPlay => Element.playEvent.forTarget(this);onPlaying no setter override ​
Implementation
dart
Stream<Event> get onPlaying => Element.playingEvent.forTarget(this);onPopState no setter override ​
Stream<PopStateEvent> get onPopStateStream of popstate events handled by this Window.
Implementation
dart
Stream<PopStateEvent> get onPopState => popStateEvent.forTarget(this);onProgress no setter ​
Implementation
dart
Stream<Event> get onProgress => progressEvent.forTarget(this);onRateChange no setter override ​
Implementation
dart
Stream<Event> get onRateChange => Element.rateChangeEvent.forTarget(this);onReset no setter override ​
Stream of reset events handled by this Window.
Implementation
dart
Stream<Event> get onReset => Element.resetEvent.forTarget(this);onResize no setter override ​
Stream of resize events handled by this Window.
Implementation
dart
Stream<Event> get onResize => Element.resizeEvent.forTarget(this);onScroll no setter override ​
Stream of scroll events handled by this Window.
Implementation
dart
Stream<Event> get onScroll => Element.scrollEvent.forTarget(this);onSearch no setter ​
Stream of search events handled by this Window.
Implementation
dart
Stream<Event> get onSearch => Element.searchEvent.forTarget(this);onSeeked no setter override ​
Implementation
dart
Stream<Event> get onSeeked => Element.seekedEvent.forTarget(this);onSeeking no setter override ​
Implementation
dart
Stream<Event> get onSeeking => Element.seekingEvent.forTarget(this);onSelect no setter override ​
Stream of select events handled by this Window.
Implementation
dart
Stream<Event> get onSelect => Element.selectEvent.forTarget(this);onStalled no setter override ​
Implementation
dart
Stream<Event> get onStalled => Element.stalledEvent.forTarget(this);onStorage no setter override ​
Stream<StorageEvent> get onStorageStream of storage events handled by this Window.
Implementation
dart
Stream<StorageEvent> get onStorage => storageEvent.forTarget(this);onSubmit no setter override ​
Stream of submit events handled by this Window.
Implementation
dart
Stream<Event> get onSubmit => Element.submitEvent.forTarget(this);onSuspend no setter override ​
Implementation
dart
Stream<Event> get onSuspend => Element.suspendEvent.forTarget(this);onTimeUpdate no setter override ​
Implementation
dart
Stream<Event> get onTimeUpdate => Element.timeUpdateEvent.forTarget(this);onTouchCancel no setter override ​
Stream<TouchEvent> get onTouchCancelStream of touchcancel events handled by this Window.
Implementation
dart
Stream<TouchEvent> get onTouchCancel =>
Element.touchCancelEvent.forTarget(this);onTouchEnd no setter override ​
Stream<TouchEvent> get onTouchEndStream of touchend events handled by this Window.
Implementation
dart
Stream<TouchEvent> get onTouchEnd => Element.touchEndEvent.forTarget(this);onTouchMove no setter override ​
Stream<TouchEvent> get onTouchMoveStream of touchmove events handled by this Window.
Implementation
dart
Stream<TouchEvent> get onTouchMove => Element.touchMoveEvent.forTarget(this);onTouchStart no setter override ​
Stream<TouchEvent> get onTouchStartStream of touchstart events handled by this Window.
Implementation
dart
Stream<TouchEvent> get onTouchStart =>
Element.touchStartEvent.forTarget(this);onTransitionEnd no setter ​
Stream<TransitionEvent> get onTransitionEndStream of transitionend events handled by this Window.
Implementation
dart
Stream<TransitionEvent> get onTransitionEnd =>
Element.transitionEndEvent.forTarget(this);onUnload no setter override ​
Stream of unload events handled by this Window.
Implementation
dart
Stream<Event> get onUnload => unloadEvent.forTarget(this);onVolumeChange no setter override ​
Implementation
dart
Stream<Event> get onVolumeChange => Element.volumeChangeEvent.forTarget(this);onWaiting no setter override ​
Implementation
dart
Stream<Event> get onWaiting => Element.waitingEvent.forTarget(this);onWheel no setter override ​
Stream<WheelEvent> get onWheelStream of wheel events handled by this Window.
Implementation
dart
Stream<WheelEvent> get onWheel => Element.wheelEvent.forTarget(this);opener read / write override-getter ​
WindowBase? get openerA reference to the window that opened this one.
dart
Window thisWindow = window;
WindowBase otherWindow = thisWindow.open('http://www.example.com/', 'foo');
print(otherWindow.opener == thisWindow); // 'true'Implementation
dart
WindowBase? get opener => _convertNativeToDart_Window(this._get_opener);
set opener(WindowBase? value) native;orientation no setter ​
int? get orientationImplementation
dart
int? get orientation native;origin no setter ​
String? get originImplementation
dart
String? get origin native;outerHeight no setter ​
int get outerHeightThe height of this window including all user interface elements.
Other resources ​
- Window.outerHeight from MDN.
Implementation
dart
int get outerHeight native;outerWidth no setter ​
int get outerWidthThe width of the window including all user interface elements.
Other resources ​
- Window.outerWidth from MDN.
Implementation
dart
int get outerWidth native;pageXOffset no setter ​
int get pageXOffsetImplementation
dart
int get pageXOffset => JS<num>('num', '#.pageXOffset', this).round();pageYOffset no setter ​
int get pageYOffsetImplementation
dart
int get pageYOffset => JS<num>('num', '#.pageYOffset', this).round();parent no setter override ​
WindowBase? get parentA reference to the parent of this window.
If this WindowBase has no parent, parent will return a reference to the WindowBase itself.
dart
IFrameElement myIFrame = new IFrameElement();
window.document.body.elements.add(myIFrame);
print(myIframe.contentWindow.parent == window) // 'true'
print(window.parent == window) // 'true'Implementation
dart
WindowBase? get parent => _convertNativeToDart_Window(this._get_parent);performance no setter ​
Performance get performanceTiming and navigation data for this window.
Other resources ​
- Measuring page load speed with navigation timing from HTML5Rocks.
- Navigation timing specification from W3C.
Implementation
dart
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE)
Performance get performance native;runtimeType no setter inherited ​
Type get runtimeTypeInherited from Interceptor.
Implementation
dart
Type get runtimeType =>
getRuntimeTypeOfInterceptorNotArray(getInterceptor(this), this);screen no setter ​
Screen? get screenInformation about the screen displaying this window.
Other resources ​
- The Screen interface specification from W3C.
Implementation
dart
Screen? get screen native;screenLeft no setter ​
int? get screenLeftThe distance from the left side of the screen to the left side of this window.
Other resources ​
- The Screen interface specification from W3C.
Implementation
dart
int? get screenLeft native;screenTop no setter ​
int? get screenTopThe distance from the top of the screen to the top of this window.
Other resources ​
- The Screen interface specification from W3C.
Implementation
dart
int? get screenTop native;screenX no setter ​
int? get screenXThe distance from the left side of the screen to the mouse pointer.
Other resources ​
- The Screen interface specification from W3C.
Implementation
dart
int? get screenX native;screenY no setter ​
int? get screenYThe distance from the top of the screen to the mouse pointer.
Other resources ​
- The Screen interface specification from W3C.
Implementation
dart
int? get screenY native;scrollbars no setter ​
BarProp? get scrollbarsThis window's scroll bars.
Other resources ​
- Browser interface elements from WHATWG.
Implementation
dart
BarProp? get scrollbars native;scrollX no setter ​
int get scrollXThe distance this window has been scrolled horizontally.
Other resources ​
- The Screen interface specification from W3C.
- scrollX from MDN.
Implementation
dart
int get scrollX => JS<bool>('bool', '("scrollX" in #)', this)
? JS<num>('num', '#.scrollX', this).round()
: document.documentElement!.scrollLeft;scrollY no setter ​
int get scrollYThe distance this window has been scrolled vertically.
Other resources ​
- The Screen interface specification from W3C.
- scrollY from MDN.
Implementation
dart
int get scrollY => JS<bool>('bool', '("scrollY" in #)', this)
? JS<num>('num', '#.scrollY', this).round()
: document.documentElement!.scrollTop;self no setter ​
WindowBase? get selfThe current window.
Other resources ​
- Window.self from MDN.
Implementation
dart
WindowBase? get self => _convertNativeToDart_Window(this._get_self);sessionStorage no setter ​
Storage get sessionStorageStorage for this window that is cleared when this session ends.
Other resources ​
- DOM storage guide from MDN.
- The past, present & future of local storage for web applications from Dive Into HTML5.
- Local storage specification from W3C.
Implementation
dart
Storage get sessionStorage native;speechSynthesis no setter ​
SpeechSynthesis? get speechSynthesisAccess to speech synthesis in the browser.
Other resources ​
- Web speech specification from W3C.
Implementation
dart
SpeechSynthesis? get speechSynthesis native;status read / write ​
String? get statusDeprecated.
Implementation
dart
String? get status native;
set status(String? value) native;statusbar no setter ​
BarProp? get statusbarThis window's status bar.
Other resources ​
- Browser interface elements from WHATWG.
Implementation
dart
BarProp? get statusbar native;styleMedia no setter ​
StyleMedia? get styleMediaAccess to CSS media queries.
Other resources ​
- StyleMedia class reference from Safari Developer Library.
Implementation
dart
StyleMedia? get styleMedia native;toolbar no setter ​
BarProp? get toolbarThis window's tool bar.
Other resources ​
- Browser interface elements from WHATWG.
Implementation
dart
BarProp? get toolbar native;top no setter override ​
WindowBase? get topA reference to the topmost window in the window hierarchy.
If this WindowBase is the topmost WindowBase, top will return a reference to the WindowBase itself.
dart
// Add an IFrame to the current window.
IFrameElement myIFrame = new IFrameElement();
window.document.body.elements.add(myIFrame);
// Add an IFrame inside of the other IFrame.
IFrameElement innerIFrame = new IFrameElement();
myIFrame.elements.add(innerIFrame);
print(myIframe.contentWindow.top == window) // 'true'
print(innerIFrame.contentWindow.top == window) // 'true'
print(window.top == window) // 'true'Implementation
dart
WindowBase? get top => _convertNativeToDart_Window(this._get_top);visualViewport no setter ​
VisualViewport? get visualViewportImplementation
dart
VisualViewport? get visualViewport native;window no setter ​
WindowBase? get windowThe current window.
Other resources ​
- Window.window from MDN.
Implementation
dart
WindowBase? get window => _convertNativeToDart_Window(this._get_window);Methods ​
addEventListener() inherited ​
void addEventListener(
String type,
(dynamic Function(Event event))? listener, [
bool? useCapture,
])Inherited from EventTarget.
Implementation
dart
void addEventListener(
String type,
EventListener? listener, [
bool? useCapture,
]) {
// TODO(leafp): This check is avoid a bug in our dispatch code when
// listener is null. The browser treats this call as a no-op in this
// case, so it's fine to short-circuit it, but we should not have to.
if (listener != null) {
_addEventListener(type, listener, useCapture);
}
}alert() ​
void alert([String? message])Displays a modal alert to the user.
Other resources ​
- User prompts from WHATWG.
Implementation
dart
void alert([String? message]) native;atob() override ​
Implementation
dart
String atob(String atob) native;btoa() override ​
Implementation
dart
String btoa(String btoa) native;cancelAnimationFrame() ​
void cancelAnimationFrame(int id)Cancels an animation frame request.
Other resources ​
- Window.cancelAnimationFrame from MDN.
Implementation
dart
void cancelAnimationFrame(int id) {
_ensureRequestAnimationFrame();
_cancelAnimationFrame(id);
}cancelIdleCallback() ​
void cancelIdleCallback(int handle)Implementation
dart
void cancelIdleCallback(int handle) native;close() override ​
void close()Closes the window.
This method should only succeed if the WindowBase object is script-closeable and the window calling close is allowed to navigate the window.
A window is script-closeable if it is either a window that was opened by another window, or if it is a window with only one document in its history.
A window might not be allowed to navigate, and therefore close, another window due to browser security features.
dart
var other = window.open('http://www.example.com', 'foo');
// Closes other window, as it is script-closeable.
other.close();
print(other.closed); // 'true'
var newLocation = window.location
..href = 'http://www.mysite.com';
window.location = newLocation;
// Does not close this window, as the history has changed.
window.close();
print(window.closed); // 'false'See also:
- Window close discussion from the W3C
Implementation
dart
void close() native;confirm() ​
Displays a modal OK/Cancel prompt to the user.
Other resources ​
- User prompts from WHATWG.
Implementation
dart
bool confirm([String? message]) native;dispatchEvent() inherited ​
Inherited from EventTarget.
Implementation
dart
bool dispatchEvent(Event event) native;fetch() ​
Implementation
dart
Future fetch(/*RequestInfo*/ input, [Map? init]) {
var init_dict = null;
if (init != null) {
init_dict = convertDartToNative_Dictionary(init);
}
return promiseToFuture(
JS("creates:_Response;", "#.fetch(#, #)", this, input, init_dict),
);
}find() ​
bool find(
String? string,
bool? caseSensitive,
bool? backwards,
bool? wrap,
bool? wholeWord,
bool? searchInFrames,
bool? showDialog,
)Finds text in this window.
Other resources ​
- Window.find from MDN.
Implementation
dart
bool find(
String? string,
bool? caseSensitive,
bool? backwards,
bool? wrap,
bool? wholeWord,
bool? searchInFrames,
bool? showDialog,
) native;getComputedStyleMap() ​
StylePropertyMapReadonly getComputedStyleMap(
Element element,
String? pseudoElement,
)Implementation
dart
StylePropertyMapReadonly getComputedStyleMap(
Element element,
String? pseudoElement,
) native;getMatchedCssRules() ​
Returns all CSS rules that apply to the element's pseudo-element.
Implementation
dart
@JSName('getMatchedCSSRules')
/**
* Returns all CSS rules that apply to the element's pseudo-element.
*/
@Returns('_CssRuleList')
@Creates('_CssRuleList')
List<CssRule> getMatchedCssRules(
Element? element,
String? pseudoElement,
) native;getSelection() ​
Selection? getSelection()Returns the currently selected text.
Other resources ​
- Window.getSelection from MDN.
Implementation
dart
Selection? getSelection() native;matchMedia() ​
MediaQueryList matchMedia(String query)Returns a list of media queries for the given query string.
Other resources ​
- Testing media queries from MDN.
- The MediaQueryList specification from W3C.
Implementation
dart
MediaQueryList matchMedia(String query) native;moveBy() ​
Moves this window.
x and y can be negative.
Other resources ​
- Window.moveBy from MDN.
- Window.moveBy from W3C.
Implementation
dart
void moveBy(int x, int y) native;moveTo() ​
Moves this window to a specific position.
x and y can be negative.
Other resources ​
- Window.moveTo from MDN.
- Window.moveTo from W3C.
Implementation
dart
void moveTo(Point p) {
_moveTo(p.x.toInt(), p.y.toInt());
}noSuchMethod() inherited ​
dynamic noSuchMethod(Invocation invocation)Invoked when a nonexistent method or property is accessed.
A dynamic member invocation can attempt to call a member which doesn't exist on the receiving object. Example:
dart
dynamic object = 1;
object.add(42); // Statically allowed, run-time errorThis invalid code will invoke the noSuchMethod method of the integer 1 with an Invocation representing the .add(42) call and arguments (which then throws).
Classes can override noSuchMethod to provide custom behavior for such invalid dynamic invocations.
A class with a non-default noSuchMethod invocation can also omit implementations for members of its interface. Example:
dart
class MockList<T> implements List<T> {
noSuchMethod(Invocation invocation) {
log(invocation);
super.noSuchMethod(invocation); // Will throw.
}
}
void main() {
MockList().add(42);
}This code has no compile-time warnings or errors even though the MockList class has no concrete implementation of any of the List interface methods. Calls to List methods are forwarded to noSuchMethod, so this code will log an invocation similar to Invocation.method(#add, [42]) and then throw.
If a value is returned from noSuchMethod, it becomes the result of the original invocation. If the value is not of a type that can be returned by the original invocation, a type error occurs at the invocation.
The default behavior is to throw a NoSuchMethodError.
Inherited from Interceptor.
Implementation
dart
dynamic noSuchMethod(Invocation invocation) {
throw NoSuchMethodError.withInvocation(this, invocation);
}open() ​
WindowBase open(String url, String name, [String? options])Opens a new window.
Other resources ​
- Window.open from MDN.
Implementation
dart
WindowBase open(String url, String name, [String? options]) {
final win = options == null
? _open2(url, name)
: _open3(url, name, options);
return _DOMWindowCrossFrame._createSafe(win);
}postMessage() override ​
Sends a cross-origin message.
Other resources ​
- window.postMessage from MDN.
- Cross-document messaging from WHATWG.
Implementation
dart
void postMessage(
/*any*/ message,
String targetOrigin, [
List<Object>? transfer,
]) {
if (transfer != null) {
var message_1 = convertDartToNative_SerializedScriptValue(message);
_postMessage_1(message_1, targetOrigin, transfer);
return;
}
var message_1 = convertDartToNative_SerializedScriptValue(message);
_postMessage_2(message_1, targetOrigin);
return;
}print() ​
void print()Opens the print dialog for this window.
Other resources ​
- Window.print from MDN.
Implementation
dart
void print() native;removeEventListener() inherited ​
void removeEventListener(
String type,
(dynamic Function(Event event))? listener, [
bool? useCapture,
])Inherited from EventTarget.
Implementation
dart
void removeEventListener(
String type,
EventListener? listener, [
bool? useCapture,
]) {
// TODO(leafp): This check is avoid a bug in our dispatch code when
// listener is null. The browser treats this call as a no-op in this
// case, so it's fine to short-circuit it, but we should not have to.
if (listener != null) {
_removeEventListener(type, listener, useCapture);
}
}requestAnimationFrame() ​
Called to draw an animation frame and then request the window to repaint after callback has finished (creating the animation).
Use this method only if you need to later call cancelAnimationFrame. If not, the preferred Dart idiom is to set animation frames by calling animationFrame, which returns a Future.
Returns a non-zero valued integer to represent the request id for this request. This value only needs to be saved if you intend to call cancelAnimationFrame so you can specify the particular animation to cancel.
Note: The supplied callback needs to call requestAnimationFrame again for the animation to continue.
Implementation
dart
int requestAnimationFrame(FrameRequestCallback callback) {
_ensureRequestAnimationFrame();
return _requestAnimationFrame(_wrapZone(callback)!);
}requestFileSystem() ​
Future<FileSystem> requestFileSystem(int size, {bool persistent = false})Access a sandboxed file system of size bytes.
If persistent is true, the application will request permission from the user to create lasting storage. This storage cannot be freed without the user's permission. Returns a Future whose value stores a reference to the sandboxed file system for use. Because the file system is sandboxed, applications cannot access file systems created in other web pages.
Implementation
dart
Future<FileSystem> requestFileSystem(int size, {bool persistent = false}) {
return _requestFileSystem(persistent ? 1 : 0, size);
}requestIdleCallback() ​
int requestIdleCallback(
void Function(IdleDeadline deadline) callback, [
Map<dynamic, dynamic>? options,
])Implementation
dart
int requestIdleCallback(IdleRequestCallback callback, [Map? options]) {
if (options != null) {
var callback_1 = convertDartClosureToJS(callback, 1);
var options_2 = convertDartToNative_Dictionary(options);
return _requestIdleCallback_1(callback_1, options_2);
}
var callback_1 = convertDartClosureToJS(callback, 1);
return _requestIdleCallback_2(callback_1);
}resizeBy() ​
Resizes this window by an offset.
Other resources ​
- Window.resizeBy from MDN.
Implementation
dart
void resizeBy(int x, int y) native;resizeTo() ​
Resizes this window to a specific width and height.
Other resources ​
- Window.resizeTo from MDN.
Implementation
dart
void resizeTo(int x, int y) native;resolveLocalFileSystemUrl() ​
Asynchronously retrieves a local filesystem entry.
Other resources ​
Implementation
dart
@JSName('webkitResolveLocalFileSystemURL')
/**
* Asynchronously retrieves a local filesystem entry.
*
* ## Other resources
*
* * [Obtaining access to file system entry
* points](http://www.w3.org/TR/file-system-api/#obtaining-access-to-file-system-entry-points)
* from W3C.
*/
@SupportedBrowser(SupportedBrowser.CHROME)
Future<Entry> resolveLocalFileSystemUrl(String url) {
var completer = new Completer<Entry>();
_resolveLocalFileSystemUrl(
url,
(value) {
completer.complete(value);
},
(error) {
completer.completeError(error);
},
);
return completer.future;
}scroll() ​
void scroll([
dynamic options_OR_x,
dynamic y,
Map<dynamic, dynamic>? scrollOptions,
])Scrolls the page horizontally and vertically to a specific point.
This method is identical to scrollTo.
Other resources ​
- Window.scroll from MDN.
Implementation
dart
void scroll([options_OR_x, y, Map? scrollOptions]) {
if (options_OR_x == null && y == null && scrollOptions == null) {
_scroll_1();
return;
}
if ((options_OR_x is Map) && y == null && scrollOptions == null) {
var options_1 = convertDartToNative_Dictionary(options_OR_x);
_scroll_2(options_1);
return;
}
if ((y is num) && (options_OR_x is num) && scrollOptions == null) {
_scroll_3(options_OR_x, y);
return;
}
if ((y is int) && (options_OR_x is int) && scrollOptions == null) {
_scroll_4(options_OR_x, y);
return;
}
if (scrollOptions != null && (y is int) && (options_OR_x is int)) {
var scrollOptions_1 = convertDartToNative_Dictionary(scrollOptions);
_scroll_5(options_OR_x, y, scrollOptions_1);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}scrollBy() ​
void scrollBy([
dynamic options_OR_x,
dynamic y,
Map<dynamic, dynamic>? scrollOptions,
])Scrolls the page horizontally and vertically by an offset.
Other resources ​
- Window.scrollBy from MDN.
Implementation
dart
void scrollBy([options_OR_x, y, Map? scrollOptions]) {
if (options_OR_x == null && y == null && scrollOptions == null) {
_scrollBy_1();
return;
}
if ((options_OR_x is Map) && y == null && scrollOptions == null) {
var options_1 = convertDartToNative_Dictionary(options_OR_x);
_scrollBy_2(options_1);
return;
}
if ((y is num) && (options_OR_x is num) && scrollOptions == null) {
_scrollBy_3(options_OR_x, y);
return;
}
if ((y is int) && (options_OR_x is int) && scrollOptions == null) {
_scrollBy_4(options_OR_x, y);
return;
}
if (scrollOptions != null && (y is int) && (options_OR_x is int)) {
var scrollOptions_1 = convertDartToNative_Dictionary(scrollOptions);
_scrollBy_5(options_OR_x, y, scrollOptions_1);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}scrollTo() ​
void scrollTo([
dynamic options_OR_x,
dynamic y,
Map<dynamic, dynamic>? scrollOptions,
])Scrolls the page horizontally and vertically to a specific point.
This method is identical to scroll.
Other resources ​
- Window.scrollTo from MDN.
Implementation
dart
void scrollTo([options_OR_x, y, Map? scrollOptions]) {
if (options_OR_x == null && y == null && scrollOptions == null) {
_scrollTo_1();
return;
}
if ((options_OR_x is Map) && y == null && scrollOptions == null) {
var options_1 = convertDartToNative_Dictionary(options_OR_x);
_scrollTo_2(options_1);
return;
}
if ((y is num) && (options_OR_x is num) && scrollOptions == null) {
_scrollTo_3(options_OR_x, y);
return;
}
if ((y is int) && (options_OR_x is int) && scrollOptions == null) {
_scrollTo_4(options_OR_x, y);
return;
}
if (scrollOptions != null && (y is int) && (options_OR_x is int)) {
var scrollOptions_1 = convertDartToNative_Dictionary(scrollOptions);
_scrollTo_5(options_OR_x, y, scrollOptions_1);
return;
}
throw new ArgumentError("Incorrect number or type of arguments");
}stop() ​
void stop()Stops the window from loading.
Other resources ​
- The Window object from W3C.
Implementation
dart
void stop() native;toString() inherited ​
String toString()A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.
Inherited from Interceptor.
Implementation
dart
String toString() => Primitives.objectToHumanReadableString(this);Operators ​
operator ==() inherited ​
The equality operator.
The default behavior for all Objects is to return true if and only if this object and other are the same object.
Override this method to specify a different equality relation on a class. The overriding method must still be an equivalence relation. That is, it must be:
Total: It must return a boolean for all arguments. It should never throw.
Reflexive: For all objects
o,o == omust be true.Symmetric: For all objects
o1ando2,o1 == o2ando2 == o1must either both be true, or both be false.Transitive: For all objects
o1,o2, ando3, ifo1 == o2ando2 == o3are true, theno1 == o3must be true.
The method should also be consistent over time, so whether two objects are equal should only change if at least one of the objects was modified.
If a subclass overrides the equality operator, it should override the hashCode method as well to maintain consistency.
Inherited from Interceptor.
Implementation
dart
bool operator ==(Object other) => identical(this, other);Static Properties ​
supportsPointConversions no setter ​
bool get supportsPointConversionsconvertPointFromNodeToPage and convertPointFromPageToNode are removed. see http://dev.w3.org/csswg/cssom-view/#geometry
Implementation
dart
static bool get supportsPointConversions => DomPoint.supported;Constants ​
animationEndEvent ​
const EventStreamProvider<AnimationEvent> animationEndEventStatic factory designed to expose animationend events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
static const EventStreamProvider<AnimationEvent> animationEndEvent =
const EventStreamProvider<AnimationEvent>('webkitAnimationEnd');animationIterationEvent ​
const EventStreamProvider<AnimationEvent> animationIterationEventStatic factory designed to expose animationiteration events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
static const EventStreamProvider<AnimationEvent> animationIterationEvent =
const EventStreamProvider<AnimationEvent>('webkitAnimationIteration');animationStartEvent ​
const EventStreamProvider<AnimationEvent> animationStartEventStatic factory designed to expose animationstart events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.SAFARI)
static const EventStreamProvider<AnimationEvent> animationStartEvent =
const EventStreamProvider<AnimationEvent>('webkitAnimationStart');beforeUnloadEvent ​
const EventStreamProvider<BeforeUnloadEvent> beforeUnloadEventStatic factory designed to expose beforeunload events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<BeforeUnloadEvent> beforeUnloadEvent =
const EventStreamProvider('beforeunload');contentLoadedEvent ​
const EventStreamProvider<Event> contentLoadedEventStatic factory designed to expose contentloaded events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<Event> contentLoadedEvent =
const EventStreamProvider<Event>('DOMContentLoaded');deviceMotionEvent ​
const EventStreamProvider<DeviceMotionEvent> deviceMotionEventStatic factory designed to expose devicemotion events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<DeviceMotionEvent> deviceMotionEvent =
const EventStreamProvider<DeviceMotionEvent>('devicemotion');deviceOrientationEvent ​
const EventStreamProvider<DeviceOrientationEvent> deviceOrientationEventStatic factory designed to expose deviceorientation events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<DeviceOrientationEvent>
deviceOrientationEvent = const EventStreamProvider<DeviceOrientationEvent>(
'deviceorientation',
);hashChangeEvent ​
const EventStreamProvider<Event> hashChangeEventStatic factory designed to expose hashchange events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<Event> hashChangeEvent =
const EventStreamProvider<Event>('hashchange');loadStartEvent ​
const EventStreamProvider<Event> loadStartEventImplementation
dart
static const EventStreamProvider<Event> loadStartEvent =
const EventStreamProvider<Event>('loadstart');messageEvent ​
const EventStreamProvider<MessageEvent> messageEventStatic factory designed to expose message events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<MessageEvent> messageEvent =
const EventStreamProvider<MessageEvent>('message');offlineEvent ​
const EventStreamProvider<Event> offlineEventStatic factory designed to expose offline events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<Event> offlineEvent =
const EventStreamProvider<Event>('offline');onlineEvent ​
const EventStreamProvider<Event> onlineEventStatic factory designed to expose online events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<Event> onlineEvent =
const EventStreamProvider<Event>('online');pageHideEvent ​
const EventStreamProvider<Event> pageHideEventStatic factory designed to expose pagehide events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<Event> pageHideEvent =
const EventStreamProvider<Event>('pagehide');pageShowEvent ​
const EventStreamProvider<Event> pageShowEventStatic factory designed to expose pageshow events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<Event> pageShowEvent =
const EventStreamProvider<Event>('pageshow');PERSISTENT ​
const int PERSISTENTIndicates that file system data cannot be cleared unless given user permission.
Other resources ​
- Exploring the FileSystem APIs from HTML5Rocks.
- File API from W3C.
Implementation
dart
static const int PERSISTENT = 1;popStateEvent ​
const EventStreamProvider<PopStateEvent> popStateEventStatic factory designed to expose popstate events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<PopStateEvent> popStateEvent =
const EventStreamProvider<PopStateEvent>('popstate');progressEvent ​
const EventStreamProvider<Event> progressEventImplementation
dart
static const EventStreamProvider<Event> progressEvent =
const EventStreamProvider<Event>('progress');storageEvent ​
const EventStreamProvider<StorageEvent> storageEventStatic factory designed to expose storage events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<StorageEvent> storageEvent =
const EventStreamProvider<StorageEvent>('storage');TEMPORARY ​
const int TEMPORARYIndicates that file system data can be cleared at any time.
Other resources ​
- Exploring the FileSystem APIs from HTML5Rocks.
- File API from W3C.
Implementation
dart
static const int TEMPORARY = 0;unloadEvent ​
const EventStreamProvider<Event> unloadEventStatic factory designed to expose unload events to event handlers that are not necessarily instances of Window.
See EventStreamProvider for usage information.
Implementation
dart
static const EventStreamProvider<Event> unloadEvent =
const EventStreamProvider<Event>('unload');