explore_ method

void explore_()

Displays a File or Directory in host operating system's default file explorer.

Implementation

void explore_() async {
  if (Platform.isWindows) {
    await Process.start(
      'explorer.exe',
      [
        '/select,',
        path.startsWith(kWin32LocalPathPrefix)
            ? path.substring(kWin32LocalPathPrefix.length)
            : path,
      ],
      runInShell: true,
      includeParentEnvironment: true,
      mode: ProcessStartMode.detached,
    );
  }
  if (Platform.isLinux) {
    await Process.start(
      'dbus-send',
      [
        '--session',
        '--print-reply',
        '--dest=org.freedesktop.FileManager1',
        '--type=method_call',
        '/org/freedesktop/FileManager1',
        'org.freedesktop.FileManager1.ShowItems',
        'array:string:$uri',
        'string:""',
      ],
      runInShell: true,
      includeParentEnvironment: true,
      mode: ProcessStartMode.detached,
    );
  }
  // TODO: Support other platforms.
}