homeDirectory top-level property
String
homeDirectory
Returns the home directory of the OS.
Implementation
String get homeDirectory {
try {
if (Platform.isMacOS) return Platform.environment['HOME']!;
if (Platform.isLinux) return Platform.environment['HOME']!;
if (Platform.isWindows) return Platform.environment['UserProfile']!;
throw Exception();
} catch (_) {
throw Exception('Missing home directory');
}
}