readJson method

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

Implementation

Future<Map<String, dynamic>?> readJson({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 Map<String, dynamic>;
    } else {
      return json.decode(encryptedData) as Map<String, dynamic>;
    }
  }
  return null;
}