PlanningCenterApiWhere.parse constructor

PlanningCenterApiWhere.parse(
  1. String attribute,
  2. String value
)

Implementation

factory PlanningCenterApiWhere.parse(String attribute, String value) {
  String? operator;
  var match = RegExp(r'([<>]?)(=?)(.*)').matchAsPrefix(value);
  if (match != null) {
    value = match.group(3)!;
    switch (match.group(1)) {
      case '<':
        operator = 'lt';
        break;
      case '>':
        operator = 'gt';
    }
    if (match.group(2) == '=' && operator != null) operator += 'e';
  }
  return PlanningCenterApiWhere(attribute, value, operator);
}