groupPropsByOp static method

Implementation

static Iterable<({ProppatchRequestOp op, List<ProppatchRequestProp> props})>
    groupPropsByOp(Iterable<ProppatchRequestProp> props) {
  final result =
      <({ProppatchRequestOp op, List<ProppatchRequestProp> props})>[];
  var currentProps = <ProppatchRequestProp>[];
  ProppatchRequestOp? currentOp;
  for (var prop in props) {
    if (currentOp != prop.op) {
      currentOp = prop.op;
      currentProps = [];
      result.add((op: prop.op, props: currentProps));
    }
    currentProps.add(prop);
  }
  return result;
}