getInt method

int? getInt(
  1. String key
)

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

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

Implementation

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