clippy 1.0.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 78

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

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:


dependencies:
  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';
  
Version Uploaded Documentation Archive
1.0.0 Aug 9, 2018 Go to the documentation of clippy 1.0.0 Download clippy 1.0.0 archive
0.2.0 Jul 16, 2017 Go to the documentation of clippy 0.2.0 Download clippy 0.2.0 archive
0.1.0 Jul 15, 2017 Go to the documentation of clippy 0.1.0 Download clippy 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
69
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
78
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: web

Platform components identified in package: html, io.

Health issues and suggestions

Document public APIs (-10 points)

7 out of 7 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Format lib/src/server.dart.

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

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use clippy.dart. Packages with multiple examples should use example/readme.md.

Dependencies

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