findDesktopFileWithScheme method

Future<String?> findDesktopFileWithScheme(
  1. ProtocolScheme scheme
)

Returns the .desktop filename that contains the scheme.scheme.

Implementation

Future<String?> findDesktopFileWithScheme(ProtocolScheme scheme) async {
  final ProcessResult result = await Process.run(
    'xdg-mime',
    <String>['query', 'default', 'x-scheme-handler/${scheme.scheme}'],
  );
  final String filename = result.stdout.toString().trim();
  return filename.isNotEmpty ? filename : null;
}