getImagePathFromClipboard method

Future<String?> getImagePathFromClipboard()

Try to get an image file path from the clipboard.

Implementation

Future<String?> getImagePathFromClipboard() async {
  final commands = _getClipboardCommands();
  try {
    final result = await Process.run('bash', ['-c', commands.getPath]);
    if (result.exitCode != 0 || (result.stdout as String).isEmpty) {
      return null;
    }
    return (result.stdout as String).trim();
  } catch (e) {
    _logError(e);
    return null;
  }
}