Use function instead of getter
diff --git a/lib/pub_cache.dart b/lib/pub_cache.dart
index 13bd907..21f3640 100644
--- a/lib/pub_cache.dart
+++ b/lib/pub_cache.dart
@@ -34,12 +34,6 @@
List<Application> _applications;
List<PackageRef> _packageRefs;
- String get _hostedPackageDirectoryName {
- final url = Uri.parse(
- Platform.environment['PUB_HOSTED_URL'] ?? 'https://pub.dartlang.org');
- return url.host;
- }
-
/// Create a pubcache instance. [dir] defaults to the default platform pub
/// cache location.
PubCache([Directory dir])
@@ -116,7 +110,7 @@
_packageRefs = <PackageRef>[];
Directory dartlangDir = new Directory(
- path.join(location.path, 'hosted', _hostedPackageDirectoryName));
+ path.join(location.path, 'hosted', _getHostedPackageDirectoryName()));
if (dartlangDir.existsSync()) {
_packageRefs.addAll(dartlangDir
.listSync()
@@ -139,6 +133,12 @@
Directory _getSubDir(Directory dir, String name) =>
new Directory(path.join(dir.path, name));
+
+ String _getHostedPackageDirectoryName() {
+ final url = Uri.parse(
+ Platform.environment['PUB_HOSTED_URL'] ?? 'https://pub.dartlang.org');
+ return url.host;
+ }
}
/// A Dart application; a package with an entry-point, available via `pub global