toBool method

bool toBool({
  1. bool falseOnError = false,
})

Transform string to boolean type

Implementation

bool toBool({bool falseOnError = false}) {
  if (ValidatorUtils.isBool(this)) return this == 'true';
  if (falseOnError) return false;
  throw FormatException('Can only acception boolean value');
}