getInt method

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

Retrieve a value from this map

Implementation

int? getInt(String key, [int? defaultValue]) {
  if (!containsKey(key)) {
    return defaultValue;
  }

  dynamic valueDyn = this[key];

  if (valueDyn is int) {
    return valueDyn;
  }

  if (valueDyn is String) {
    return stringToInt(valueDyn, defaultValue);
  }

  return defaultValue;
}