readString method

Future<String?> readString({
  1. required String key,
  2. bool isEncrypted = true,
})

Implementation

Future<String?> readString({required String key, bool isEncrypted = true}) async {
  final encryptedData = await _secureStorage.read(key: key);
  if (encryptedData != null) {
    if (isEncrypted) {
      final decryptedData = _encrypter.decrypt64(encryptedData, iv: _iv);
      return json.decode(decryptedData) as String;
    } else {
      return json.decode(encryptedData) as String;
    }
  }
  return null;
}