diff --git a/example/assets/image1.jpg b/example/assets/image1.jpg new file mode 100644 index 0000000..c79c59e Binary files /dev/null and b/example/assets/image1.jpg differ diff --git a/example/lib/main.dart b/example/lib/main.dart index 78c12e3..e51aa95 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -30,13 +30,13 @@ class _MyAppState extends State { // Platform messages are asynchronous, so we initialize in an async method. Future initPlatformState() async { String md5SumPlugin; - String md5SumDart; + String md5SumDartCrypto; // Platform messages may fail, so we use a try/catch PlatformException. try { - //Create image + //Prepare image var directory = await getApplicationDocumentsDirectory(); - var dbPath = join(directory.path, 'image.jpg'); - var data = await rootBundle.load('assets/image.jpg'); + var dbPath = join(directory.path, 'image1.jpg'); + var data = await rootBundle.load('assets/image1.jpg'); List bytes = data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); await File(dbPath).writeAsBytes(bytes); @@ -44,18 +44,20 @@ class _MyAppState extends State { //Get md5 sum from Crypto var date = DateTime.now(); - md5SumDart = await calculateMD5SumAsyncWithCrypto(dbPath); - md5SumDart += + md5SumDartCrypto = await calculateMD5SumAsyncWithCrypto(dbPath); + print('md5SumDartCrypto: $md5SumDartCrypto'); + md5SumDartCrypto += ' - duration: ${DateTime.now().difference(date).inMilliseconds}'; //Get md5 sum from Plugin date = DateTime.now(); md5SumPlugin = await calculateMD5SumAsyncWithPlugin(dbPath); + print('md5SumPlugin: $md5SumPlugin'); md5SumPlugin += ' - duration: ${DateTime.now().difference(date).inMilliseconds}'; } on PlatformException { - md5SumPlugin = 'Failed to get md5 from Crypto'; - md5SumDart = 'Failed to get md5 from Plugin'; + md5SumPlugin = 'Failed to get md5 from Plugin'; + md5SumDartCrypto = 'Failed to get md5 from Crypto'; } // If the widget was removed from the tree while the asynchronous platform @@ -65,7 +67,7 @@ class _MyAppState extends State { setState(() { _md5SumPlugin = md5SumPlugin; - _md5SumDart = md5SumDart; + _md5SumDart = md5SumDartCrypto; }); } diff --git a/example/pubspec.lock b/example/pubspec.lock index 39a0c57..cd2044b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -73,7 +73,7 @@ packages: path: ".." relative: true source: path - version: "1.0.1" + version: "1.0.2" meta: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 8dcaa8a..c5f56a9 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -36,7 +36,7 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - - assets/image.jpg + - assets/ # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see diff --git a/md5_plugin.iml b/md5_plugin.iml index 4f83e69..db08f35 100644 --- a/md5_plugin.iml +++ b/md5_plugin.iml @@ -18,6 +18,7 @@ + diff --git a/pubspec.lock b/pubspec.lock index 040daf4..aebdafa 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,27 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" collection: dependency: transitive description: @@ -13,6 +34,18 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.5" meta: dependency: transitive description: @@ -20,11 +53,74 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.7" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.4" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0+1" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.5" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.5" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.5" typed_data: dependency: transitive description: