optInt method

int optInt(
  1. String name, {
  2. int fallback = 0,
})

Returns the value mapped by {@code name} if it exists and is an int or can be coerced to an int, or {@code fallback} otherwise.

Implementation

int optInt(String name, {int fallback = 0}) {
  dynamic object = opt(name);
  return _toInteger(object) ?? fallback;
}