I'm using : encrypt: ^3.2.0 I'm using AES encryption in flutter but when i decrypt my encrypted value it's give me this type of Error.
flutter: error: type 'String' is not a subtype of type 'Encrypted' of 'encrypted'
Future<String> getEncryption(String text) async {
String enc = '';
final SharedPreferences strFamilyPass =
await SharedPreferences.getInstance();
strFamilyPass.getString('family');
final String keys = await getKEY();
final dynamic key = Key.fromUtf8(keys);
final dynamic iv = IV.fromLength(16);
final dynamic encrypter = Encrypter(AES(key));
final String salt = await getSalt();
enc = '$salt${encrypter.encrypt(text, iv: iv).base64}';
print('encryption $enc');
return enc;
}
Future<String> getDecryption(String text) async {
String dec = '';
final String keys = await getKEY();
final dynamic key = Key.fromUtf8(keys);
final dynamic iv = IV.fromLength(16);
final encrypter = Encrypter(AES(key));
final String salt = await getSalt();
dec = '$salt${encrypter.decrypt(text, iv: iv)}';// it give's me error right here
print('decy $dec');
return dec;
}