md5_plugin

Last updated:

0 purchases

md5_plugin Image
md5_plugin Images
Add to Cart

Description:

md5 plugin

md5_plugin #
A Flutter plugin for getting the MD5 hash of the file. It's faster when compared with using the crypto package (https://pub.dev/packages/crypto).
You can check the difference in my example.
Usage #
With my plugin:
Future<String> calculateMD5SumAsyncWithPlugin(String filePath) async {
var ret = '';
var file = File(filePath);
if (await file.exists()) {
try {
ret = await Md5Plugin.getMD5WithPath(filePath);
} catch (exception) {
print('Unable to evaluate the MD5 sum :$exception');
return null;
}
} else {
print('`$filePath` does not exits so unable to evaluate its MD5 sum.');
return null;
}
return ret;
}
copied to clipboard
With crypto package:
Future<String> calculateMD5SumAsyncWithCrypto(String filePath) async {
var ret = '';
var file = File(filePath);
if (await file.exists()) {
try {
var md5 = crypto.md5;
var hash = await md5.bind(file.openRead()).first;
ret = base64.encode(hash.bytes);
} catch (exception) {
print('Unable to evaluate the MD5 sum :$exception');
return null;
}
} else {
print('`$filePath` does not exits so unable to evaluate its MD5 sum.');
return null;
}
return ret;
}
copied to clipboard
And the result:

Authors #

anlam87 ([email protected])

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.