isTrue property

bool get isTrue

判断字符标识是否true(eg. true or 1)

Implementation

bool get isTrue {
  if (this == null) {
    return false;
  }
  if (this is bool) {
    return this == true;
  }
  if (this is String) {
    return this.toString().toLowerCase().trim() == 'true';
  }
  if (this is num) {
    return this == 1;
  }
  return false;
}