asBool method

bool asBool()

Decode value to bool.

Implementation

bool asBool() {
  final value = _value;
  if (value != null) {
    final String strValue = const Utf8Codec().decode(value);
    final lowerCase = strValue.toLowerCase();
    return lowerCase == 'true' || lowerCase == '1';
  } else {
    return defaultValueForBool;
  }
}