defaultDir property
String
defaultDir
getter/setter pair
Implementation
static String defaultDir = (() {
if (Platform.environment.containsKey('PUB_CACHE')) {
return p.absolute(Platform.environment['PUB_CACHE']!);
} else if (Platform.isWindows) {
// %LOCALAPPDATA% is used as the cache location over %APPDATA%, because
// the latter is synchronised between devices when the user roams between
// them, whereas the former is not.
final localAppData = Platform.environment['LOCALAPPDATA'];
if (localAppData == null) {
dataError('''
Could not find the pub cache. No `LOCALAPPDATA` environment variable exists.
Consider setting the `PUB_CACHE` variable manually.
''');
}
return p.join(localAppData, 'Pub', 'Cache');
} else {
final home = Platform.environment['HOME'];
if (home == null) {
dataError('''
Could not find the pub cache. No `HOME` environment variable exists.
Consider setting the `PUB_CACHE` variable manually.
''');
}
return p.join(home, '.pub-cache');
}
})();