setClipboard method

  1. @override
Future<void> setClipboard(
  1. String text
)
override

Write text to the system clipboard.

Implementation

@override
Future<void> setClipboard(String text) async {
  if (_platform == NativePlatform.macos) {
    await _runPiped('pbcopy', text);
  } else if (_platform == NativePlatform.linux) {
    await _runPiped('xclip', text, args: ['-selection', 'clipboard']);
  } else if (_platform == NativePlatform.windows) {
    await _runPiped('clip', text);
  }
}