saveDeployment method
Save the deployment persistently to a file cache.
Returns true
if successful.
Implementation
Future<bool> saveDeployment() async {
bool success = true;
try {
final name = (await filename)!;
final newName =
'${await Settings().getDeploymentBasePath(studyDeploymentId!)}/$studyDeploymentId.json';
info("Saving deployment to file '$name'.");
final json = jsonEncode(deployment);
// saving two version of the deployment file - on permanently and a cached version
File(name).writeAsStringSync(json);
File(newName).writeAsStringSync(json);
} catch (exception) {
success = false;
warning('Failed to save deployment - $exception');
}
return success;
}