asBool method

bool asBool(
  1. String key, {
  2. String? section,
})

Returns a bool 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

Implementation

bool asBool(String key, {String? section}) {
  var rc = false;
  final value = asString(key, section: section);
  if (value == null) {
    final sectionPart = section == null ? '' : ' in ' + section;
    logger.error('missing $key$sectionPart');
  } else {
    rc = value.toLowerCase() == 'true';
  }
  return rc;
}