getInt abstract method

int getInt(
  1. String key,
  2. int defaultValue
)

Gets a 32-bit integer value. Returns defaultValue if the key is missing or the stored type is not int. key Lookup key. defaultValue Value to return when not found or type mismatch. Returns Stored int32 or defaultValue.

Example:

// Retrieve integer values with defaults
int userAge = _userStorage!.getInt("user_age", 0);
int loginCount = _userStorage!.getInt("login_count", 0);
int nonExistentInt = _userStorage!.getInt("non_existent_int", -1);
print("User age: $userAge");
print("Login count: $loginCount");
print("Non-existent int: $nonExistentInt");

Implementation

int getInt(String key, int defaultValue);