writeClipboard method
Implementation
@override
Future<void> writeClipboard(String text) async {
final result = await Process.run(
'pbcopy',
[],
environment: {},
runInShell: false,
);
// pbcopy reads from stdin
final proc = await Process.start('pbcopy', []);
proc.stdin.write(text);
await proc.stdin.close();
final exitCode = await proc.exitCode;
if (exitCode != 0) {
throw Exception('pbcopy exited with code $exitCode');
}
}