getDesktopPath function
Gets the current Operating System's Desktop path.
Implementation
String getDesktopPath() {
try {
if (Platform.isMacOS) {
return p.join('Users', Platform.environment['USER']!, 'Desktop');
} else if (Platform.isWindows) {
return p.join(Platform.environment['USERPROFILE']!, 'Desktop');
} else if (Platform.isLinux) {
return p.join('home', Platform.environment['USER']!, 'Desktop');
} else {
throw false;
}
} catch (_) {
throw UnsupportedError('Unsupported platform');
}
}