getInt static method

int getInt(
  1. String? key, [
  2. int? defValue
])

Returns 0 if key is null.

Implementation

static int getInt(String? key, [int? defValue]) {
  if (key == null) {
    return 0;
  }
  assert(_initCalled, 'Prefs.init() must be called first!');
  assert(_prefsInstance != null,
      'Maybe call Prefs.getIntF(key) instead. SharedPreferences not ready yet!');
  return _prefsInstance?.getInt(key) ?? defValue ?? 0;
}