setValueToSecureStorage method

Future<void> setValueToSecureStorage({
  1. required String key,
  2. required String value,
})

Writes a key-value pair to secure storage.

This method attempts to write the provided key and value to the secure storage. If an error occurs during the write operation, it logs an error message.

Parameters:

  • key: The key to be written to secure storage. This parameter is required.
  • value: The value to be written to secure storage. This parameter is required.

Returns: A Future that completes when the write operation is finished.

Implementation

Future<void> setValueToSecureStorage({
  required String key,
  required String value,
}) async {
  try {
    await _secureStorage.write(key: key, value: value);
  } catch (e) {
    log('Error writing to secure storage: $e');
  }
}