parseBool static method

bool? parseBool(
  1. dynamic value
)

Implementation

static bool? parseBool(dynamic value) {
  if (value == null) return null;

  if (value is bool) {
    return value;
  } else if (value is String) {
    return value.toLowerCase() == 'true' || value == '1';
  } else if (value is int) {
    return value == 1;
  }

  return null;
}