decrypt method
Implementation
Future<String> decrypt(String chiper, List<int> secret) async {
Uint8List ivCiphertextMac = base64.decode(chiper); // from the Java code
Uint8List iv = ivCiphertextMac.sublist(0, 12);
Uint8List ciphertext = ivCiphertextMac.sublist(12, ivCiphertextMac.length - 16);
Uint8List mac = ivCiphertextMac.sublist(ivCiphertextMac.length - 16);
// List<int> passphrase = utf8.encode('Test!ng012345678');
cry.SecretKey secretKey = new cry.SecretKey(secret);
cry.SecretBox secretBox = new cry.SecretBox(ciphertext, nonce: iv, mac: new cry.Mac(mac));
List<int> decrypted = await cry.AesGcm.with256bits().decrypt(secretBox, secretKey: secretKey);
String dec = utf8.decode(decrypted);
// print("Decrypted text : " + dec); // Decrypted text : Mayur, You got it!
return dec;
}