check method

Future<bool> check(
  1. File file,
  2. Hash type,
  3. String expectedHash
)

Checks the checksum of the given file using the specified type of hash and compares it to the expectedHash. Returns a Future<bool> indicating if the file's hash matches the expected hash.

Implementation

Future<bool> check(File file, Hash type, String expectedHash) async {
  final Uint8List asBytes = await file.readAsBytes();
  fileHash = type.convert(asBytes);

  return fileHash.toString() == expectedHash;
}