fromMapAsInt function

int? fromMapAsInt(
  1. Map? map,
  2. dynamic key, {
  3. int? defaultValue,
})

Returns the value from fromMap as an int if it is numeric

Implementation

int? fromMapAsInt(Map? map, dynamic key, {int? defaultValue}) {
  dynamic value = fromMap(map, key, defaultValue: defaultValue);
  if (isNumeric(value)) {
    value = toInt(value);
  } else {
    value = defaultValue;
  }
  return value;
}