getValueFromSecureStorage method

Future<String?> getValueFromSecureStorage({
  1. required String key,
})

Retrieves a value from secure storage for the given key.

This method attempts to read a value associated with the provided key from secure storage. If the read operation is successful, the value is returned as a String. If an error occurs during the read operation, an error message is logged and null is returned.

  • Parameter key: The key for which the value needs to be retrieved.
  • Returns: A Future that completes with the value associated with the given key, or null if an error occurs.

Implementation

Future<String?> getValueFromSecureStorage({required String key}) async {
  try {
    return _secureStorage.read(key: key);
  } catch (e) {
    log('Error reading from secure storage: $e');
    return null;
  }
}