clippy 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 83

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

1. Depend on it

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


dependencies:
  clippy: "^0.2.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
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

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
66 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
83

Platforms

Detected platforms: web

Platform components identified in package: html, io.

Suggestions

  • The description is too short.

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

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
path ^1.4.2 1.5.1
Dev dependencies
browser any
test ^0.12.0