homeDirectory function

String? homeDirectory()

Returns the user's home directory, or null if it cannot be determined.

Implementation

String? homeDirectory() {
  if (Platform.isWindows) {
    return Platform.environment['USERPROFILE'] ?? Platform.environment['HOME'];
  }
  return Platform.environment['HOME'];
}