getDependencyPath method

String getDependencyPath()

Implementation

String getDependencyPath() {
  String dependencyName = Utility.getPackageNameAndVersion();
  String pubCachePath;
  if (Platform.isWindows) {
    String userProfile = Platform.environment['USERPROFILE'] ?? '';
    pubCachePath = Platform.environment['PUB_CACHE'] ??
        path.join(userProfile, 'AppData', 'Local', 'Pub', 'Cache');
  } else {
    pubCachePath = Platform.environment['PUB_CACHE'] ??
        path.join(Platform.environment['HOME']!, '.pub-cache');
  }
  String dependencyPath =
      path.join(pubCachePath, 'hosted', 'pub.dev', dependencyName);

  return dependencyPath;
}