installFromDirectory method
Implementation
Directory? installFromDirectory({
required Directory directoryPackage,
bool deleteIfExist = true,
}) {
if (Dart.isWeb) {
return null;
}
final File file_pubspec =
File(path.join(directoryPackage.path, "pubspec.yaml"));
if (file_pubspec.existsSync() == false) {
return null;
}
final Map yaml_code =
(yaml.loadYaml(file_pubspec.readAsStringSync(), recover: true) as Map);
final Directory directory_pub_dev = Directory(path.join(
hosted_directory.path,
"pub.dev",
"${yaml_code["name"]}-${yaml_code["version"]}"));
if (deleteIfExist && directory_pub_dev.existsSync()) {
directory_pub_dev.deleteSync(recursive: true);
directory_pub_dev.createSync(recursive: true);
}
directoryPackage.copyTo(directory_pub_dev);
return directory_pub_dev;
}