win32_clipboard 1.0.0 copy "win32_clipboard: ^1.0.0" to clipboard
win32_clipboard: ^1.0.0 copied to clipboard

A package that provides a friendly Dart API for accessing the Windows Clipboard.

example/main.dart

import 'package:win32_clipboard/win32_clipboard.dart';

void main() {
  // Clear the clipboard initially.
  if (Clipboard.clear()) print('Clipboard cleared.');

  // Check if the clipboard is empty.
  if (Clipboard.isEmpty) print('Clipboard is empty.');

  // Set text data to the clipboard.
  const text = 'Hello, Clipboard!';
  if (Clipboard.setText(text)) print('Text set to clipboard: "$text"');

  // Check if the clipboard has text data (optional).
  if (Clipboard.hasText) {
    print('Clipboard has text data.');
    // Retrieve and print the text data from the clipboard.
    final text = Clipboard.getText();
    print('Retrieved text from clipboard: "$text"');
  }

  // Set file list data to the clipboard.
  final files = [r'c:\src\file1.dart', r'd:\file2.txt'];
  if (Clipboard.setFileList(files)) print('File list set to clipboard: $files');

  // Check if the clipboard has a file list (optional).
  if (Clipboard.hasFileList) {
    print('Clipboard has file list data.');
    // Retrieve and print the file list from the clipboard.
    final fileList = Clipboard.getFileList();
    print('Retrieved file list from clipboard: $fileList');
  }

  // Clear the clipboard.
  if (Clipboard.clear()) print('Clipboard contents cleared.');
}
8
likes
160
pub points
55%
popularity

Publisher

verified publisherhalildurmus.dev

A package that provides a friendly Dart API for accessing the Windows Clipboard.

Repository (GitHub)
View/report issues

Topics

#clipboard #win32 #ffi #windows

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

ffi, meta, win32

More

Packages that depend on win32_clipboard