removeValue method

Future<bool> removeValue(
  1. dynamic key
)

Removes a value from the shared preferences based on the provided key.

Returns a future indicating whether the operation was successful or not.

The key parameter represents the key associated with the value to remove from shared preferences.

Example:

await SimpleSharedPref().removeValue('username');

Implementation

Future<bool> removeValue(dynamic key) {
  try {
    return _preferences!.remove(key.toString());
  } catch (e) {
    _logException('Error while removing value from shared preferences',
        error: e);
    return Future.value(false);
  }
}