Clipboard class

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers. The interface implements the Clipboard API, providing—if the user grants permission—both read and write access to the contents of the system clipboard. The Clipboard API can be used to implement cut, copy, and paste features within a web application.

EventTarget

Clipboard

The system clipboard is exposed through the global Navigator.clipboard property. Calls to the methods of the object will not succeed if the user hasn't granted the needed permissions using the Permissions API and the "clipboard-read" or "clipboard-write" permission as appropriate.

Note: In reality, at this time browser requirements for access to the clipboard vary significantly. Please see the section Clipboard availability for details.

All of the Clipboard API methods operate asynchronously; they return a Future which is resolved once the clipboard access has been completed. The promise is rejected if clipboard access is denied.

Note: The clipboard is a data buffer that is used for short-term, data storage and/or data transfers, this can be between documents or applications It is usually implemented as an anonymous, temporary data buffer, sometimes called the paste buffer, that can be accessed from most or all programs within the environment via defined programming interfaces.

A typical application accesses clipboard functionality by mapping user input such as keybindings, menu selections, etc. to these interfaces.

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

Clipboard()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addEventListener(String type, EventListener? callback, [dynamic options]) → void

Available on EventTarget, provided by the PropsEventTarget extension

dispatchEvent(Event event) bool

Available on EventTarget, provided by the PropsEventTarget extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read() Future<Iterable<ClipboardItem>>

Available on Clipboard, provided by the PropsClipboard extension

readText() Future<String>

Available on Clipboard, provided by the PropsClipboard extension

removeEventListener(String type, EventListener? callback, [dynamic options]) → void

Available on EventTarget, provided by the PropsEventTarget extension

toString() String
A string representation of this object.
inherited
write(Iterable<ClipboardItem> data) Future<void>

Available on Clipboard, provided by the PropsClipboard extension

writeText(String data) Future<void>

Available on Clipboard, provided by the PropsClipboard extension

Operators

operator ==(Object other) bool
The equality operator.
inherited