dart_clipboard

Creator: coderz1093

Last updated:

0 purchases

dart_clipboard Image
dart_clipboard Images

Languages

Categories

Add to Cart

Description:

dart clipboard

dart_clipboard #
A Dart package to operate the clipboard using Rust FFI.
dart_clipboard uses the dynamic library of ippee / libclipboard crate and requires you to download or build it.
This crate uses aweinstock314 / rust-clipboard. However, the purpose of this package is not to be a wrapper for it, but to make it easily and intuitively to operate the clipboard in Dart.
Installation #
1. Add package #
dart pub add dart_clipboard
copied to clipboard
2. Prepare dynamic library #
Select either method A or B.
A: Use the existing build files
On your Dart project directory, run the following commands.
# on Windows
curl -LJO https://github.com/ippee/libclipboard/releases/download/0.2.0/libclipboard.dll

# on macOS
curl -LJO https://github.com/ippee/libclipboard/releases/download/0.2.0/libclipboard.dylib

# on Linux
curl -LJO https://github.com/ippee/libclipboard/releases/download/0.2.0/libclipboard.so
copied to clipboard
B: Use your own built files
This way is available in the environment which can use Rust.
First, add ippee / libclipboard repository as a submodule.
git submodule add [email protected]:ippee/libclipboard.git ./tool/libclipboard/
copied to clipboard
Next, build the dynamic library with:
cd ./tool/libclipboard/
cargo build --release
copied to clipboard
Finally, make the symbolic link to the built file,
# on Windows
./make_symlink.ps1

# on macOS/Linux
bash ./make_symlink.sh
copied to clipboard
or copy it to the Dart project directory.
# on Windows
./copy_lib.ps1

# on macOS/Linux
bash ./copy_lib.sh
copied to clipboard
Notes #
If you publish the Dart application which uses this package, put the dynamic library in the same directory with the executable.
Example #
import 'package:dart_clipboard/dart_clipboard.dart';

void main() {
var contents;

// Get contents of the clipboard.
contents = Clipboard.getContents();

// Set contents to the clipboard.
contents = "All the world's a stage";
Clipboard.setContents(contents);
}

copied to clipboard
License #
dart_clipboard is under the MIT License.
Note that aweinstock314 / rust-clipboard is dual-licensed under MIT and Apache2.
References #

Dart Meets Rust: a match made in heaven ✨ - DEV Community
How to call a Rust function from Dart using FFI | by Sacha Arbonel | Flutter Community | Medium

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.