asInt method

int? asInt(
  1. String key, {
  2. String? section,
  3. int? defaultValue,
})

Returns an int value given by section and key. key: the key of the (key value) pair section: if given the (key value) pair is searched in this section defaultValue: if the key does not exists this value is returned

Implementation

int? asInt(String key, {String? section, int? defaultValue}) {
  var rc = defaultValue;
  final value = asString(key,
      section: section,
      defaultValue: defaultValue == null ? null : defaultValue.toString());
  if (value != null) {
    rc = int.parse(value);
  }
  return rc;
}