fromString static method

BoolOperator fromString(
  1. String op
)

Converts a string operator representation to the corresponding enum value.

Parameters:

  • op: String representation of the operator ("&&", "||", "!")

Returns: The corresponding BoolOperator enum value

Throws:

  • Exception if the operator string is not recognized

Implementation

static BoolOperator fromString(String op) {
  switch (op) {
    case "&&":
      return BoolOperator.and;
    case "||":
      return BoolOperator.or;
    case "!":
      return BoolOperator.not;
    default:
      throw Exception("Unknown operator: $op");
  }
}