clippy 0.2.0 copy "clippy: ^0.2.0" to clipboard
clippy: ^0.2.0 copied to clipboard

outdatedDart 1 only

Access system clipboard in Dart (Server & Browser).

Clippy — Access system clipboard in Dart (Server & Browser)

Pub Build Status Build status

A library to access the clipboard (copy/paste) for server and browser

Install #

Add clippy to dependencies/dev_dependencies in in your pubspec.yaml

Usage #

Server

In the server Clippy supports writing and reading from the clipboard. It uses system tools for this:

  • On linux uses xsel (Install if needed)
  • On Mac uses pbcopy/pbpaste
  • On windows it embeds a copy/paste tool win-clipboard
import 'package:clippy/server.dart' as clippy;

main() async {
  // Write to clipboard
  await clippy.write('https://github.com/andresaraujo/clippy');
  
  // Read from clipboard
  final clipboard = await clippy.read();  
}

See example/server

Browser

In the browser Clippy supports writing and listening to paste events.

import 'package:clippy/browser.dart' as clippy;

main() async {
  
  // Write a string to clipboard
  await clippy.write('https://github.com/andresaraujo/clippy');
  
  // Write text from an element to clipboard
  await clippy.write(element);
  
  // Write current selection to clipboard
  await clippy.write();
  
  // Listen to paste event
  clippy.onPaste.listen((text) => print('OnPaste: $text'));
  
}

See example/web

9
likes
20
pub points
72%
popularity

Publisher

unverified uploader

Access system clipboard in Dart (Server & Browser).

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

path

More

Packages that depend on clippy