getString method

String? getString(
  1. String key
)

Reads a value from the cache, throwing a TypeError if the value is not a String.

Throws an ArgumentError if key is not in this instance's filter.

Implementation

String? getString(String key) {
  if (!_isValidKey(key)) {
    throw ArgumentError(
        '$key is not included in the PreferencesFilter allowlist');
  }
  return get(key) as String?;
}