isBool function

bool isBool(
  1. Object? input
)

Returns true if input is a bool, or the trimmed, case-insensitive string 'true' or 'false'.

Implementation

bool isBool(Object? input) {
  return ['true', 'false', true, false].any((e) {
    if (e is String && input is String) {
      return e.compareTo(input.trim().toLowerCase()) == 0;
    } else {
      return e == input;
    }
  });
}