Package selection guidance compiled from public package information, community data, and project usage.
The clipboard package provides Flutter developers with seamless access to the system clipboard, supporting text, rich text (HTML), and image data across Android, iOS, macOS, and Windows. It enables reading from and writing to the clipboard, making it ideal for copy-paste functionality in apps that handle formatted content or media. The package integrates smoothly with Flutter's ecosystem and is maintained by samuelezedi.com. Its open-source nature allows for community contributions and transparency.
Use cases
Copying formatted text between apps
Pasting HTML content in rich text editors
Sharing images via clipboard
Implementing copy-to-clipboard buttons
Transferring data between Flutter and native apps
Key features
Supports plain text and HTML
Handles image data
Cross-platform compatibility
Simple API for read/write operations
Open-source with public repository
Suitable for
Apps needing rich text copying
Developers building content editors
Tools requiring data exchange with system clipboard
Cross-platform desktop and mobile apps
Considerations
Requires platform-specific permissions on some systems
Image handling may vary by platform
Limited to system clipboard scope
No built-in history management
Depends on underlying OS clipboard behavior
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
Enhanced Flutter Clipboard
A super-power clipboard package for Flutter, with text, Rich text (HTML), and image support.
✅ Error Handling: Comprehensive error handling with custom exceptions and error codes
✅ Utility Methods: Check clipboard status, size, and content type
✅ Callback Support: Success and error callbacks for operations
✅ Debug Information: Get detailed clipboard debugging info
✅ Cross-Platform: Works on Android, iOS, Web, and Windows with graceful fallbacks
✅ Null Safety: Full null safety support
✅ Memory Safe: Proper listener management with cleanup mechanisms
✅ Production Ready: Battle-tested with comprehensive error handling
Installation
Add this to your package's pubspec.yaml file:
dependencies:clipboard:^3.0.14
Platform Setup
Android
The package uses platform channels for enhanced features. No additional setup required - the package automatically falls back to Flutter's built-in Clipboard API if platform channels are unavailable.
iOS
No additional setup required. The package automatically handles platform channel registration.
Web
Fully supported with automatic fallback to browser Clipboard API.
Windows
No additional setup required. The package uses native Windows API with GDI+ for image support. Platform channels are automatically registered.
import'dart:typed_data';
import'package:flutter/services.dart';
// Copy image to clipboardfinalByteData imageData = await rootBundle.load('assets/image.png');
finalUint8List imageBytes = imageData.buffer.asUint8List();
awaitFlutterClipboard.copyImage(imageBytes);
// Paste image from clipboardfinalUint8List? pastedImage = awaitFlutterClipboard.pasteImage();
if (pastedImage != null) {
// Use the image bytes (e.g., display in Image.memory)Image.memory(pastedImage);
}
// Images are also included in pasteRichText()final data = awaitFlutterClipboard.pasteRichText();
if (data.hasImage) {
print('Clipboard contains image: ${data.imageBytes?.length} bytes');
}
The package includes comprehensive testing utilities:
// Set mock data for testingawaitFlutterClipboard.setMockData('Test data');
// Get debug information for testingMap<String, dynamic> info = awaitFlutterClipboard.getDebugInfo();
Why This Enhanced Package?
I originally built this package 4 years ago for basic clipboard functionality. Over time, I realized developers needed more advanced features:
True Rich Text Support: Native HTML clipboard support via platform channels (not just in-memory storage)
Production Ready: Graceful fallbacks ensure reliability across all platforms
Modern API: Updated to latest Dart/Flutter standards with platform channel support
This enhanced version maintains backward compatibility while adding powerful new features that modern Flutter apps need. The package now uses platform channels for true multi-format support and native clipboard monitoring, with automatic fallbacks to Flutter's built-in Clipboard API when needed.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.