boolFrom static method

bool? boolFrom(
  1. dynamic value
)

Implementation

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

  if (value is String) {
    if (value == "true") {
      return true;
    } else if (value == "false") {
      return false;
    } else {
      return null;
    }
  } else if (value is bool) {
    return value;
  } else {
    return null;
  }
}