Skip to content

Window ​

Annotations: @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 ​

Inheritance

Object → EventTarget → Window

Properties ​

animationFrame no setter ​

Future<num> get animationFrame

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 animationWorklet
Implementation
dart
_Worklet? get animationWorklet native;

applicationCache no setter ​

ApplicationCache? get applicationCache

The application cache for this window.

Other resources ​

Implementation
dart
ApplicationCache? get applicationCache native;

audioWorklet no setter ​

_Worklet? get audioWorklet
Implementation
dart
_Worklet? get audioWorklet native;

caches no setter ​

CacheStorage? get caches
Implementation
dart
CacheStorage? get caches native;

closed no setter override ​

bool? get closed

Indicates 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 console

The debugging console for this window.

Implementation
dart
Console get console => Console._safeConsole;

cookieStore no setter ​

CookieStore? get cookieStore
Implementation
dart
CookieStore? get cookieStore native;

crypto no setter ​

Crypto? get crypto

Entrypoint for the browser's cryptographic functions.

Other resources ​

Implementation
dart
Crypto? get crypto native;

customElements no setter ​

CustomElementRegistry? get customElements
Implementation
dart
CustomElementRegistry? get customElements native;

defaultStatus read / write ​

String? get defaultStatus

Deprecated.

Implementation
dart
String? get defaultStatus native;

set defaultStatus(String? value) native;

defaultstatus read / write ​

String? get defaultstatus

Deprecated.

Implementation
dart
String? get defaultstatus native;

set defaultstatus(String? value) native;

devicePixelRatio no setter ​

num get devicePixelRatio

The ratio between physical pixels and logical CSS pixels.

Other resources ​

Implementation
dart
num get devicePixelRatio native;

document no setter ​

Document get document

The newest document in this window.

Other resources ​

Implementation
dart
Document get document => JS('Document', '#.document', this);

external no setter ​

External? get external
Implementation
dart
External? get external native;

hashCode no setter inherited ​

int get hashCode

Inherited from Interceptor.

Implementation
dart
int get hashCode => Primitives.objectHashCode(this);

history no setter override ​

History get history

The current session history for this window's newest document.

Other resources ​

Implementation
dart
History get history native;

indexedDB no setter ​

IdbFactory? get indexedDB

Gets 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', &#47;&#47; If not supported, returns null.
  '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB',
  this,
  this,
  this,
);

innerHeight no setter ​

int? get innerHeight

The height of the viewport including scrollbars.

Other resources ​

Implementation
dart
int? get innerHeight native;

innerWidth no setter ​

int? get innerWidth

The width of the viewport including scrollbars.

Other resources ​

Implementation
dart
int? get innerWidth native;

isSecureContext no setter ​

bool? get isSecureContext
Implementation
dart
bool? get isSecureContext native;

localStorage no setter ​

Storage get localStorage

Storage for this window that persists across sessions.

Other resources ​

Implementation
dart
Storage get localStorage native;

location read / write override-getter ​

Location get location

getter:

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 locationbar

This window's location bar, which displays the URL.

Other resources ​

Implementation
dart
BarProp? get locationbar native;

menubar no setter ​

BarProp? get menubar

This window's menu bar, which displays menu commands.

Other resources ​

Implementation
dart
BarProp? get menubar native;

name read / write ​

String? get name

The name of this window.

Other resources ​

Implementation
dart
String? get name native;

set name(String? value) native;

navigator no setter ​

Navigator get navigator

The user agent accessing this window.

Other resources ​

Implementation
dart
Navigator get navigator native;

offscreenBuffering no setter ​

bool? get offscreenBuffering

Whether objects are drawn offscreen before being displayed.

Other resources ​

Implementation
dart
bool? get offscreenBuffering native;

on no setter inherited ​

Events get on

This 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<Event> get onAbort

Stream of abort events handled by this Window.

Implementation
dart
Stream<Event> get onAbort => Element.abortEvent.forTarget(this);

onAnimationEnd no setter ​

Stream<AnimationEvent> get onAnimationEnd

Stream of animationend events handled by this Window.

Implementation
dart
Stream<AnimationEvent> get onAnimationEnd =>
    animationEndEvent.forTarget(this);

onAnimationIteration no setter ​

Stream<AnimationEvent> get onAnimationIteration

Stream of animationiteration events handled by this Window.

Implementation
dart
Stream<AnimationEvent> get onAnimationIteration =>
    animationIterationEvent.forTarget(this);

onAnimationStart no setter ​

Stream<AnimationEvent> get onAnimationStart

Stream of animationstart events handled by this Window.

Implementation
dart
Stream<AnimationEvent> get onAnimationStart =>
    animationStartEvent.forTarget(this);

onBeforeUnload no setter ​

Stream<Event> get onBeforeUnload

Stream of beforeunload events handled by this Window.

Implementation
dart
Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this);

onBlur no setter override ​

Stream<Event> get onBlur

Stream of blur events handled by this Window.

Implementation
dart
Stream<Event> get onBlur => Element.blurEvent.forTarget(this);

onCanPlay no setter override ​

Stream<Event> get onCanPlay
Implementation
dart
Stream<Event> get onCanPlay => Element.canPlayEvent.forTarget(this);

onCanPlayThrough no setter override ​

Stream<Event> get onCanPlayThrough
Implementation
dart
Stream<Event> get onCanPlayThrough =>
    Element.canPlayThroughEvent.forTarget(this);

onChange no setter override ​

Stream<Event> get onChange

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 onClick

Stream of click events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onClick => Element.clickEvent.forTarget(this);

onContentLoaded no setter ​

Stream<Event> get onContentLoaded

Stream of contentloaded events handled by this Window.

Implementation
dart
Stream<Event> get onContentLoaded => contentLoadedEvent.forTarget(this);

onContextMenu no setter override ​

Stream<MouseEvent> get onContextMenu

Stream of contextmenu events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onContextMenu =>
    Element.contextMenuEvent.forTarget(this);

onDeviceMotion no setter ​

Stream<DeviceMotionEvent> get onDeviceMotion

Stream of devicemotion events handled by this Window.

Implementation
dart
Stream<DeviceMotionEvent> get onDeviceMotion =>
    deviceMotionEvent.forTarget(this);

onDeviceOrientation no setter ​

Stream<DeviceOrientationEvent> get onDeviceOrientation

Stream of deviceorientation events handled by this Window.

Implementation
dart
Stream<DeviceOrientationEvent> get onDeviceOrientation =>
    deviceOrientationEvent.forTarget(this);

onDoubleClick no setter override ​

Stream<Event> get onDoubleClick

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 onDrag

Stream of drag events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onDrag => Element.dragEvent.forTarget(this);

onDragEnd no setter override ​

Stream<MouseEvent> get onDragEnd

Stream of dragend events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onDragEnd => Element.dragEndEvent.forTarget(this);

onDragEnter no setter override ​

Stream<MouseEvent> get onDragEnter

Stream of dragenter events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onDragEnter => Element.dragEnterEvent.forTarget(this);

onDragLeave no setter override ​

Stream<MouseEvent> get onDragLeave

Stream of dragleave events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onDragLeave => Element.dragLeaveEvent.forTarget(this);

onDragOver no setter override ​

Stream<MouseEvent> get onDragOver

Stream of dragover events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onDragOver => Element.dragOverEvent.forTarget(this);

onDragStart no setter override ​

Stream<MouseEvent> get onDragStart

Stream of dragstart events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onDragStart => Element.dragStartEvent.forTarget(this);

onDrop no setter override ​

Stream<MouseEvent> get onDrop

Stream of drop events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onDrop => Element.dropEvent.forTarget(this);

onDurationChange no setter override ​

Stream<Event> get onDurationChange
Implementation
dart
Stream<Event> get onDurationChange =>
    Element.durationChangeEvent.forTarget(this);

onEmptied no setter override ​

Stream<Event> get onEmptied
Implementation
dart
Stream<Event> get onEmptied => Element.emptiedEvent.forTarget(this);

onEnded no setter override ​

Stream<Event> get onEnded
Implementation
dart
Stream<Event> get onEnded => Element.endedEvent.forTarget(this);

onError no setter override ​

Stream<Event> get onError

Stream of error events handled by this Window.

Implementation
dart
Stream<Event> get onError => Element.errorEvent.forTarget(this);

onFocus no setter override ​

Stream<Event> get onFocus

Stream of focus events handled by this Window.

Implementation
dart
Stream<Event> get onFocus => Element.focusEvent.forTarget(this);

onHashChange no setter override ​

Stream<Event> get onHashChange

Stream of hashchange events handled by this Window.

Implementation
dart
Stream<Event> get onHashChange => hashChangeEvent.forTarget(this);

onInput no setter override ​

Stream<Event> get onInput

Stream of input events handled by this Window.

Implementation
dart
Stream<Event> get onInput => Element.inputEvent.forTarget(this);

onInvalid no setter override ​

Stream<Event> get onInvalid

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 onKeyDown

Stream of keydown events handled by this Window.

Implementation
dart
Stream<KeyboardEvent> get onKeyDown => Element.keyDownEvent.forTarget(this);

onKeyPress no setter override ​

Stream<KeyboardEvent> get onKeyPress

Stream of keypress events handled by this Window.

Implementation
dart
Stream<KeyboardEvent> get onKeyPress => Element.keyPressEvent.forTarget(this);

onKeyUp no setter override ​

Stream<KeyboardEvent> get onKeyUp

Stream of keyup events handled by this Window.

Implementation
dart
Stream<KeyboardEvent> get onKeyUp => Element.keyUpEvent.forTarget(this);

onLoad no setter override ​

Stream<Event> get onLoad

Stream of load events handled by this Window.

Implementation
dart
Stream<Event> get onLoad => Element.loadEvent.forTarget(this);

onLoadedData no setter override ​

Stream<Event> get onLoadedData
Implementation
dart
Stream<Event> get onLoadedData => Element.loadedDataEvent.forTarget(this);

onLoadedMetadata no setter override ​

Stream<Event> get onLoadedMetadata
Implementation
dart
Stream<Event> get onLoadedMetadata =>
    Element.loadedMetadataEvent.forTarget(this);

onLoadStart no setter ​

Stream<Event> get onLoadStart
Implementation
dart
Stream<Event> get onLoadStart => loadStartEvent.forTarget(this);

onMessage no setter override ​

Stream<MessageEvent> get onMessage

Stream of message events handled by this Window.

Implementation
dart
Stream<MessageEvent> get onMessage => messageEvent.forTarget(this);

onMouseDown no setter override ​

Stream<MouseEvent> get onMouseDown

Stream of mousedown events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onMouseDown => Element.mouseDownEvent.forTarget(this);

onMouseEnter no setter override ​

Stream<MouseEvent> get onMouseEnter

Stream of mouseenter events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onMouseEnter =>
    Element.mouseEnterEvent.forTarget(this);

onMouseLeave no setter override ​

Stream<MouseEvent> get onMouseLeave

Stream of mouseleave events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onMouseLeave =>
    Element.mouseLeaveEvent.forTarget(this);

onMouseMove no setter override ​

Stream<MouseEvent> get onMouseMove

Stream of mousemove events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onMouseMove => Element.mouseMoveEvent.forTarget(this);

onMouseOut no setter override ​

Stream<MouseEvent> get onMouseOut

Stream of mouseout events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onMouseOut => Element.mouseOutEvent.forTarget(this);

onMouseOver no setter override ​

Stream<MouseEvent> get onMouseOver

Stream of mouseover events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onMouseOver => Element.mouseOverEvent.forTarget(this);

onMouseUp no setter override ​

Stream<MouseEvent> get onMouseUp

Stream of mouseup events handled by this Window.

Implementation
dart
Stream<MouseEvent> get onMouseUp => Element.mouseUpEvent.forTarget(this);

onMouseWheel no setter override ​

Stream<WheelEvent> get onMouseWheel

Stream of mousewheel events handled by this Window.

Implementation
dart
Stream<WheelEvent> get onMouseWheel =>
    Element.mouseWheelEvent.forTarget(this);

onOffline no setter override ​

Stream<Event> get onOffline

Stream of offline events handled by this Window.

Implementation
dart
Stream<Event> get onOffline => offlineEvent.forTarget(this);

onOnline no setter override ​

Stream<Event> get onOnline

Stream of online events handled by this Window.

Implementation
dart
Stream<Event> get onOnline => onlineEvent.forTarget(this);

onPageHide no setter ​

Stream<Event> get onPageHide

Stream of pagehide events handled by this Window.

Implementation
dart
Stream<Event> get onPageHide => pageHideEvent.forTarget(this);

onPageShow no setter ​

Stream<Event> get onPageShow

Stream of pageshow events handled by this Window.

Implementation
dart
Stream<Event> get onPageShow => pageShowEvent.forTarget(this);

onPause no setter override ​

Stream<Event> get onPause
Implementation
dart
Stream<Event> get onPause => Element.pauseEvent.forTarget(this);

onPlay no setter override ​

Stream<Event> get onPlay
Implementation
dart
Stream<Event> get onPlay => Element.playEvent.forTarget(this);

onPlaying no setter override ​

Stream<Event> get onPlaying
Implementation
dart
Stream<Event> get onPlaying => Element.playingEvent.forTarget(this);

onPopState no setter override ​

Stream<PopStateEvent> get onPopState

Stream of popstate events handled by this Window.

Implementation
dart
Stream<PopStateEvent> get onPopState => popStateEvent.forTarget(this);

onProgress no setter ​

Stream<Event> get onProgress
Implementation
dart
Stream<Event> get onProgress => progressEvent.forTarget(this);

onRateChange no setter override ​

Stream<Event> get onRateChange
Implementation
dart
Stream<Event> get onRateChange => Element.rateChangeEvent.forTarget(this);

onReset no setter override ​

Stream<Event> get onReset

Stream of reset events handled by this Window.

Implementation
dart
Stream<Event> get onReset => Element.resetEvent.forTarget(this);

onResize no setter override ​

Stream<Event> get onResize

Stream of resize events handled by this Window.

Implementation
dart
Stream<Event> get onResize => Element.resizeEvent.forTarget(this);

onScroll no setter override ​

Stream<Event> get onScroll

Stream of scroll events handled by this Window.

Implementation
dart
Stream<Event> get onScroll => Element.scrollEvent.forTarget(this);

onSearch no setter ​

Stream<Event> get onSearch

Stream of search events handled by this Window.

Implementation
dart
Stream<Event> get onSearch => Element.searchEvent.forTarget(this);

onSeeked no setter override ​

Stream<Event> get onSeeked
Implementation
dart
Stream<Event> get onSeeked => Element.seekedEvent.forTarget(this);

onSeeking no setter override ​

Stream<Event> get onSeeking
Implementation
dart
Stream<Event> get onSeeking => Element.seekingEvent.forTarget(this);

onSelect no setter override ​

Stream<Event> get onSelect

Stream of select events handled by this Window.

Implementation
dart
Stream<Event> get onSelect => Element.selectEvent.forTarget(this);

onStalled no setter override ​

Stream<Event> get onStalled
Implementation
dart
Stream<Event> get onStalled => Element.stalledEvent.forTarget(this);

onStorage no setter override ​

Stream<StorageEvent> get onStorage

Stream of storage events handled by this Window.

Implementation
dart
Stream<StorageEvent> get onStorage => storageEvent.forTarget(this);

onSubmit no setter override ​

Stream<Event> get onSubmit

Stream of submit events handled by this Window.

Implementation
dart
Stream<Event> get onSubmit => Element.submitEvent.forTarget(this);

onSuspend no setter override ​

Stream<Event> get onSuspend
Implementation
dart
Stream<Event> get onSuspend => Element.suspendEvent.forTarget(this);

onTimeUpdate no setter override ​

Stream<Event> get onTimeUpdate
Implementation
dart
Stream<Event> get onTimeUpdate => Element.timeUpdateEvent.forTarget(this);

onTouchCancel no setter override ​

Stream<TouchEvent> get onTouchCancel

Stream of touchcancel events handled by this Window.

Implementation
dart
Stream<TouchEvent> get onTouchCancel =>
    Element.touchCancelEvent.forTarget(this);

onTouchEnd no setter override ​

Stream<TouchEvent> get onTouchEnd

Stream of touchend events handled by this Window.

Implementation
dart
Stream<TouchEvent> get onTouchEnd => Element.touchEndEvent.forTarget(this);

onTouchMove no setter override ​

Stream<TouchEvent> get onTouchMove

Stream of touchmove events handled by this Window.

Implementation
dart
Stream<TouchEvent> get onTouchMove => Element.touchMoveEvent.forTarget(this);

onTouchStart no setter override ​

Stream<TouchEvent> get onTouchStart

Stream of touchstart events handled by this Window.

Implementation
dart
Stream<TouchEvent> get onTouchStart =>
    Element.touchStartEvent.forTarget(this);

onTransitionEnd no setter ​

Stream<TransitionEvent> get onTransitionEnd

Stream of transitionend events handled by this Window.

Implementation
dart
Stream<TransitionEvent> get onTransitionEnd =>
    Element.transitionEndEvent.forTarget(this);

onUnload no setter override ​

Stream<Event> get onUnload

Stream of unload events handled by this Window.

Implementation
dart
Stream<Event> get onUnload => unloadEvent.forTarget(this);

onVolumeChange no setter override ​

Stream<Event> get onVolumeChange
Implementation
dart
Stream<Event> get onVolumeChange => Element.volumeChangeEvent.forTarget(this);

onWaiting no setter override ​

Stream<Event> get onWaiting
Implementation
dart
Stream<Event> get onWaiting => Element.waitingEvent.forTarget(this);

onWheel no setter override ​

Stream<WheelEvent> get onWheel

Stream of wheel events handled by this Window.

Implementation
dart
Stream<WheelEvent> get onWheel => Element.wheelEvent.forTarget(this);

opener read / write override-getter ​

WindowBase? get opener

A 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 orientation
Implementation
dart
int? get orientation native;

origin no setter ​

String? get origin
Implementation
dart
String? get origin native;

outerHeight no setter ​

int get outerHeight

The height of this window including all user interface elements.

Other resources ​

Implementation
dart
int get outerHeight native;

outerWidth no setter ​

int get outerWidth

The width of the window including all user interface elements.

Other resources ​

Implementation
dart
int get outerWidth native;

pageXOffset no setter ​

int get pageXOffset
Implementation
dart
int get pageXOffset => JS<num>('num', '#.pageXOffset', this).round();

pageYOffset no setter ​

int get pageYOffset
Implementation
dart
int get pageYOffset => JS<num>('num', '#.pageYOffset', this).round();

parent no setter override ​

WindowBase? get parent

A 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 performance

Timing and navigation data for this window.

Other resources ​

Implementation
dart
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE)
Performance get performance native;

runtimeType no setter inherited ​

Type get runtimeType

Inherited from Interceptor.

Implementation
dart
Type get runtimeType =>
    getRuntimeTypeOfInterceptorNotArray(getInterceptor(this), this);

screen no setter ​

Screen? get screen

Information about the screen displaying this window.

Other resources ​

Implementation
dart
Screen? get screen native;

screenLeft no setter ​

int? get screenLeft

The distance from the left side of the screen to the left side of this window.

Other resources ​

Implementation
dart
int? get screenLeft native;

screenTop no setter ​

int? get screenTop

The distance from the top of the screen to the top of this window.

Other resources ​

Implementation
dart
int? get screenTop native;

screenX no setter ​

int? get screenX

The distance from the left side of the screen to the mouse pointer.

Other resources ​

Implementation
dart
int? get screenX native;

screenY no setter ​

int? get screenY

The distance from the top of the screen to the mouse pointer.

Other resources ​

Implementation
dart
int? get screenY native;

scrollbars no setter ​

BarProp? get scrollbars

This window's scroll bars.

Other resources ​

Implementation
dart
BarProp? get scrollbars native;

scrollX no setter ​

int get scrollX

The distance this window has been scrolled horizontally.

Other resources ​

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 scrollY

The distance this window has been scrolled vertically.

Other resources ​

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 self

The current window.

Other resources ​

Implementation
dart
WindowBase? get self => _convertNativeToDart_Window(this._get_self);

sessionStorage no setter ​

Storage get sessionStorage

Storage for this window that is cleared when this session ends.

Other resources ​

Implementation
dart
Storage get sessionStorage native;

speechSynthesis no setter ​

SpeechSynthesis? get speechSynthesis

Access to speech synthesis in the browser.

Other resources ​

Implementation
dart
SpeechSynthesis? get speechSynthesis native;

status read / write ​

String? get status

Deprecated.

Implementation
dart
String? get status native;

set status(String? value) native;

statusbar no setter ​

BarProp? get statusbar

This window's status bar.

Other resources ​

Implementation
dart
BarProp? get statusbar native;

styleMedia no setter ​

StyleMedia? get styleMedia

Access to CSS media queries.

Other resources ​

Implementation
dart
StyleMedia? get styleMedia native;

toolbar no setter ​

BarProp? get toolbar

This window's tool bar.

Other resources ​

Implementation
dart
BarProp? get toolbar native;

top no setter override ​

WindowBase? get top

A 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 visualViewport
Implementation
dart
VisualViewport? get visualViewport native;

window no setter ​

WindowBase? get window

The current window.

Other resources ​

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,
]) {
  &#47;&#47; TODO(leafp): This check is avoid a bug in our dispatch code when
  &#47;&#47; listener is null.  The browser treats this call as a no-op in this
  &#47;&#47; 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 ​

Implementation
dart
void alert([String? message]) native;

atob() override ​

String atob(String atob)
Implementation
dart
String atob(String atob) native;

btoa() override ​

String btoa(String btoa)
Implementation
dart
String btoa(String btoa) native;

cancelAnimationFrame() ​

void cancelAnimationFrame(int id)

Cancels an animation frame request.

Other resources ​

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:

Implementation
dart
void close() native;

confirm() ​

bool confirm([String? message])

Displays a modal OK/Cancel prompt to the user.

Other resources ​

Implementation
dart
bool confirm([String? message]) native;

dispatchEvent() inherited ​

bool dispatchEvent(Event event)

Inherited from EventTarget.

Implementation
dart
bool dispatchEvent(Event event) native;

fetch() ​

Future<dynamic> fetch(dynamic input, [Map<dynamic, dynamic>? init])
Implementation
dart
Future fetch(&#47;*RequestInfo*&#47; 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 ​

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() ​

List<CssRule> getMatchedCssRules(Element? element, String? pseudoElement)

Returns all CSS rules that apply to the element's pseudo-element.

Implementation
dart
@JSName('getMatchedCSSRules')
&#47;**
 * Returns all CSS rules that apply to the element's pseudo-element.
 *&#47;
@Returns('_CssRuleList')
@Creates('_CssRuleList')
List<CssRule> getMatchedCssRules(
  Element? element,
  String? pseudoElement,
) native;

getSelection() ​

Selection? getSelection()

Returns the currently selected text.

Other resources ​

Implementation
dart
Selection? getSelection() native;

matchMedia() ​

MediaQueryList matchMedia(String query)

Returns a list of media queries for the given query string.

Other resources ​

Implementation
dart
MediaQueryList matchMedia(String query) native;

moveBy() ​

void moveBy(int x, int y)

Moves this window.

x and y can be negative.

Other resources ​

Implementation
dart
void moveBy(int x, int y) native;

moveTo() ​

void moveTo(Point<num> p)

Moves this window to a specific position.

x and y can be negative.

Other resources ​

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 error

This 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 ​

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 ​

void postMessage(dynamic message, String targetOrigin, [List<Object>? transfer])

Sends a cross-origin message.

Other resources ​

Implementation
dart
void postMessage(
  &#47;*any*&#47; 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.

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,
]) {
  &#47;&#47; TODO(leafp): This check is avoid a bug in our dispatch code when
  &#47;&#47; listener is null.  The browser treats this call as a no-op in this
  &#47;&#47; case, so it's fine to short-circuit it, but we should not have to.
  if (listener != null) {
    _removeEventListener(type, listener, useCapture);
  }
}

requestAnimationFrame() ​

int requestAnimationFrame(void Function(num highResTime) callback)

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() ​

void resizeBy(int x, int y)

Resizes this window by an offset.

Other resources ​

Implementation
dart
void resizeBy(int x, int y) native;

resizeTo() ​

void resizeTo(int x, int y)

Resizes this window to a specific width and height.

Other resources ​

Implementation
dart
void resizeTo(int x, int y) native;

resolveLocalFileSystemUrl() ​

Future<Entry> resolveLocalFileSystemUrl(String url)

Asynchronously retrieves a local filesystem entry.

Other resources ​

Implementation
dart
@JSName('webkitResolveLocalFileSystemURL')
&#47;**
 * Asynchronously retrieves a local filesystem entry.
 *
 * ## Other resources
 *
 * * [Obtaining access to file system entry
 *   points](http:&#47;&#47;www.w3.org&#47;TR&#47;file-system-api&#47;#obtaining-access-to-file-system-entry-points)
 * from W3C.
 *&#47;
@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 ​

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 ​

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 ​

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 ​

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 ​

bool operator ==(Object other)

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 == o must be true.

  • Symmetric: For all objects o1 and o2, o1 == o2 and o2 == o1 must either both be true, or both be false.

  • Transitive: For all objects o1, o2, and o3, if o1 == o2 and o2 == o3 are true, then o1 == o3 must 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 supportsPointConversions

convertPointFromNodeToPage 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> animationEndEvent

Static 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> animationIterationEvent

Static 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> animationStartEvent

Static 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> beforeUnloadEvent

Static 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> contentLoadedEvent

Static 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> deviceMotionEvent

Static 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> deviceOrientationEvent

Static 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> hashChangeEvent

Static 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> loadStartEvent
Implementation
dart
static const EventStreamProvider<Event> loadStartEvent =
    const EventStreamProvider<Event>('loadstart');

messageEvent ​

const EventStreamProvider<MessageEvent> messageEvent

Static 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> offlineEvent

Static 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> onlineEvent

Static 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> pageHideEvent

Static 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> pageShowEvent

Static 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 PERSISTENT

Indicates that file system data cannot be cleared unless given user permission.

Other resources ​

Implementation
dart
static const int PERSISTENT = 1;

popStateEvent ​

const EventStreamProvider<PopStateEvent> popStateEvent

Static 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> progressEvent
Implementation
dart
static const EventStreamProvider<Event> progressEvent =
    const EventStreamProvider<Event>('progress');

storageEvent ​

const EventStreamProvider<StorageEvent> storageEvent

Static 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 TEMPORARY

Indicates that file system data can be cleared at any time.

Other resources ​

Implementation
dart
static const int TEMPORARY = 0;

unloadEvent ​

const EventStreamProvider<Event> unloadEvent

Static 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');