clippy 1.0.0

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('');
  // Read from clipboard
  final clipboard = await;  

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('');
  // 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

Changelog #

0.2.0 #

  • copy now returns a Future<bool>
  • Better error handling

0.1.0 #

  • Initial version, works on Linux, Osx, Windows and Browser

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  clippy: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:clippy/browser.dart';
import 'package:clippy/server.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Aug 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19


Detected platforms: web

Platform components identified in package: html, io.

Health issues and suggestions

Document public APIs. (-1 points)

7 out of 7 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/src/server.dart.

Run dartfmt to format lib/src/server.dart.

Maintenance suggestions

The package description is too short. (-9 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is getting outdated. (-2.74 points)

The package was last published 53 weeks ago.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and clippy.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
path ^1.4.2 1.6.4
Dev dependencies
test ^1.3.0