readClipboard method

  1. @override
Future<String> readClipboard()
override

Implementation

@override
Future<String> readClipboard() async {
  final result = await Process.run('pbpaste', []);
  if (result.exitCode != 0) {
    throw Exception('pbpaste exited with code ${result.exitCode}');
  }
  return result.stdout as String;
}