From c79c4e5097ab2d2f004432528a39268740e1458c Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Wed, 15 Apr 2020 21:35:38 +0200 Subject: [PATCH] Fix example --- example/lib/main.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 7e54a9c..1771998 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -20,13 +20,13 @@ class _MyAppState extends State { String _bench; AES aes = AES(); - Encrypted encrypted = Encrypted(); + Encrypted encrypted; Uint8List decryptedPayload; void _generateKey() async { - await aes.init(KeySize.bits256); + await aes.init(keySize: KeySize.bits256); setState(() { - _output = 'Key generated.'; + _output = 'Key generated. Length: ${aes.key.length}'; }); } @@ -145,7 +145,7 @@ class _MyAppState extends State { 'Encrypt String', style: TextStyle(color: Colors.white), )), - (encrypted.cipherText != null && encrypted.cipherText.isNotEmpty) + (encrypted != null && encrypted.cipherText != null && encrypted.cipherText.isNotEmpty) ? Text(encrypted.cipherText.toString()) : Container(), FlatButton( @@ -218,7 +218,7 @@ class _MyAppState extends State { class TypeHelper { /// Returns bytes `Uint8List` from a `String`. Uint8List stringToBytes(String source) { - var list = source.codeUnits; + var list = source.runes.toList(); var bytes = Uint8List.fromList(list); return bytes; }