parseBool static method

bool parseBool(
  1. dynamic value, {
  2. bool whenNull = false,
})

Parses the dynamic value into a bool. This will return true if and only if the value is...

  • true
  • "true" (case insensitive)
  • "yes" (case insensitive)
  • 1

When value is null, this will return whenNull.

Implementation

static bool parseBool(dynamic value, {bool whenNull = false}) {
  final result = maybeParseBool(value) ?? whenNull;

  return result;
}