boolParse function

bool boolParse(
  1. String? value
)

This will parse various conceptual representaitons of yes/no into a boolean

Implementation

bool boolParse(String? value) {
  if (value == null) return false;

  if (value.toLowerCase() == 'true') return true;
  if (value.toLowerCase() == 'false') return false;

  if (value.toLowerCase() == '1') return true;
  if (value.toLowerCase() == '0') return false;

  if (value.toLowerCase() == 'yes') return true;
  if (value.toLowerCase() == 'no') return false;

  return false;
}