Last updated:
0 purchases
md5 file checksum
Notice #
This project is archived and I won't update it any more.
I have run some performance tests to compare this implementation with a pure Dart one using Flutter 3 and Dart 2.17. The results of the 2 methods are comparable and in the same order of magnitude. Therefore, in my opinion, a native implementation is not needed any more to calculate a file checksum.
A Dart implementation could be like:
Future<String?> getFileChecksum(String filePath) async {
final file = File(filePath);
if (!file.existsSync()) return null;
try {
final stream = file.openRead();
final hash = await md5.bind(stream).first;
// NOTE: You might not need to convert it to base64
return base64.encode(hash.bytes);
} catch (exception) {
return null;
}
}
copied to clipboard
md5_file_checksum #
Flutter plugin to calculate a file checksum as MD5 hash, using a platform native implementation.
Revamped version of md5_plugin.
Usage #
try {
final fileChecksum = await Md5FileChecksum.getFileChecksum(filePath: filePath);
} catch (exception) {
print('Unable to generate file checksum: $exception');
}
copied to clipboard
Result #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.