diff --git a/packages/flutter_tools/lib/src/base/common.dart b/packages/flutter_tools/lib/src/base/common.dart index 501f889a72..2a9ab27e4a 100644 --- a/packages/flutter_tools/lib/src/base/common.dart +++ b/packages/flutter_tools/lib/src/base/common.dart @@ -7,16 +7,14 @@ import 'platform.dart'; /// Return the absolute path of the user's home directory String get homeDirPath { - if (_homeDirPath == null) { - _homeDirPath = platform.isWindows - ? platform.environment['USERPROFILE'] - : platform.environment['HOME']; - if (_homeDirPath != null) - _homeDirPath = fs.path.absolute(_homeDirPath); + String path = platform.isWindows + ? platform.environment['USERPROFILE'] + : platform.environment['HOME']; + if (path != null) { + path = fs.path.absolute(path); } - return _homeDirPath; + return path; } -String _homeDirPath; /// Throw a specialized exception for expected situations /// where the tool should exit with a clear message to the user