Clipboard extension type

The Clipboard interface of the Clipboard API provides read and write access to the contents of the system clipboard. This allows a web application to implement cut, copy, and paste features.

The system clipboard is exposed through the global Navigator.clipboard property.

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

All the methods require a secure context. Additional requirements for using the API are discussed in the Security consideration section of the API overview topic.

on
Implemented types

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, [JSAny options]) → void
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
inherited
dispatchEvent(Event event) bool
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read([ClipboardUnsanitizedFormats formats]) JSPromise<ClipboardItems>
The read() method of the Clipboard interface requests a copy of the clipboard's contents, fulfilling the returned Promise with the data.
readText() JSPromise<JSString>
The readText() method of the Clipboard interface returns a Promise which fulfils with a copy of the textual contents of the system clipboard.
removeEventListener(String type, EventListener? callback, [JSAny options]) → void
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
inherited
toString() String
A string representation of this object.
inherited
write(ClipboardItems data) JSPromise<JSAny?>
The write() method of the Clipboard interface writes arbitrary data to the clipboard, such as images, fulfilling the returned Promise on completion. This can be used to implement cut and copy functionality.
writeText(String data) JSPromise<JSAny?>
The writeText() method of the Clipboard interface writes the specified text to the system clipboard, returning a Promise that is resolved once the system clipboard has been updated.

Operators

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