toBool static method

bool? toBool(
  1. String input
)

Converts a string to a boolean if possible. Accepts "true" or "false" (case-insensitive).

Implementation

static bool? toBool(String input) {
  final lower = input.toLowerCase();
  if (lower == 'true') return true;
  if (lower == 'false') return false;
  return null;
}