computeSha256 method

Future<String> computeSha256(
  1. String artifactPath
)

Computes SHA-256 hash string of file at artifactPath.

Implementation

Future<String> computeSha256(String artifactPath) async {
  final file = File(artifactPath);
  if (!await file.exists()) {
    throw ValidationException('Artifact file missing at "$artifactPath".');
  }

  final bytes = await file.readAsBytes();
  final digest = sha256.convert(bytes);
  return digest.toString();
}