toBool method

bool toBool({
  1. bool caseSensitive = true,
})

Converts the string to a boolean.

Implementation

bool toBool({bool caseSensitive = true}) {
  final val = caseSensitive ? this : toLowerCase();
  if (val == 'true') return true;
  if (val == 'false') return false;
  throw FormatException('Invalid boolean string: $this');
}