ClipboardService class

Service for managing clipboard operations, history, and system clipboard integration.

Constructors

ClipboardService({int ringSize = 30, int pollIntervalMs = 1000})

Properties

hashCode int
The hash code for this object.
no setterinherited
pollIntervalMs int
How often watchClipboard polls the system clipboard (in milliseconds).
final
ring ClipboardRing
The clipboard ring buffer.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearHistory() → void
Clear the clipboard history. Does not affect the system clipboard.
copy(String text, {ClipboardSource source = ClipboardSource.user, ClipboardContentType contentType = ClipboardContentType.text, String? label}) Future<void>
Copy text to both the system clipboard and the internal ring.
copyDiff(String diff) Future<void>
Format a diff string and copy it to the clipboard.
copyFile(String path) Future<void>
Read the content of path and copy it to the clipboard.
copyPath(String path) Future<void>
Copy a file path to the clipboard.
copyToolOutput(String output, {bool trim = true}) Future<void>
Copy tool output to the clipboard, optionally trimming whitespace.
cyclePaste() Future<String?>
Cycle through the ring buffer (like Emacs kill-ring / VS Code clipboard history). Each call returns the next older entry.
dispose() → void
Stop watching the system clipboard and release resources.
formatForPaste(ClipboardEntry entry, {bool asMarkdown = false}) String
Format a ClipboardEntry for pasting into a document.
getHistory() List<ClipboardEntry>
Get all entries in the clipboard history (most recent first).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paste() Future<String?>
Paste the most recent entry from the system clipboard.
pasteFromRing(int index) Future<String?>
Paste a specific entry from the ring by index (0 = most recent).
toString() String
A string representation of this object.
inherited
watchClipboard() Stream<ClipboardEntry>
Watch the system clipboard for changes.

Operators

operator ==(Object other) bool
The equality operator.
inherited