toBoolOrNull method

bool? toBoolOrNull()

Parses as bool.

Implementation

bool? toBoolOrNull() {
  final String v = trim().toLowerCase();
  if (v == 'true' || v == '1' || v == 'yes') return true;
  if (v == 'false' || v == '0' || v == 'no') return false;
  return null;
}