asInt method

int asInt(
  1. String path, {
  2. int defaultValue = 0,
})

returns the value at path as an int. If the value isn't an int then an exception will be thrown. If the key isn't a valid int then defaultValue is returned Use validInt to determine if the key exists and is a valid int.

Implementation

int asInt(String path, {int defaultValue = 0}) =>
    validInt(path) ? valueMap[path] as int : defaultValue;