getIntF static method

Future<int> getIntF(
  1. String? key, [
  2. int? defValue
])

Returns a Future. Returns 0 if key is null.

Implementation

static Future<int> getIntF(String? key, [int? defValue]) async {
  int value;
  if (key == null) {
    return 0;
  }
  if (_prefsInstance == null) {
    final prefs = await instance;
    value = prefs.getInt(key) ?? defValue ?? 0;
  } else {
    // SharedPreferences is available. Ignore init() function.
    _initCalled = true;
    value = getInt(key, defValue);
  }
  return value;
}