getBool function

  1. @Deprecated('Angular now supports boolean properties natively, for @Attribute' ' use [attributeToBool].')
bool getBool(
  1. dynamic inputValue
)

A typed version of getDynamic.

If inputValue is a bool, returns it. If inputValue is a String, then '' and 'true' evaluate to true while 'false' evaluates to false. All other string values produce an argument error.

NOTE: inputValue must be non-null.

Implementation

@Deprecated('Angular now supports boolean properties natively, for @Attribute'
    ' use [attributeToBool].')
bool getBool(inputValue) {
  if (inputValue == null) throw ArgumentError.notNull('inputValue');

  if (inputValue is String) return _parseBool(inputValue);
  if (inputValue is bool) return inputValue;

  throw ArgumentError.value(
      inputValue, 'inputValue', 'Expected a String, or bool type');
}