read method

Reads the clipboard items asynchronously.

Returns:

  • a Future that completes with an Iterable of ClipboardItems if the read operation was successful,
  • a Future that completes with an empty Iterable if the clipboard is empty,
  • a Future that completes with null if the read operation failed or the clipboard is unsupported.

Implementation

Future<Iterable<ClipboardItem>> read() async {
  final Future<Iterable<dynamic>> items =
      js_util.promiseToFuture(js_util.callMethod(this, 'read', <Object?>[]));
  return (await items).cast<ClipboardItem>();
}