replaceConstraint method

bool replaceConstraint(
  1. String oldConstraint,
  2. String newConstraint
)

Replace a constraint

Replaces the first occurrence of oldConstraint with newConstraint. Returns true if the constraint was replaced, false otherwise.

Implementation

bool replaceConstraint(String oldConstraint, String newConstraint) {
  final index = _constraints.indexOf(oldConstraint);
  if (index != -1) {
    _constraints[index] = newConstraint;
    return true;
  }
  return false;
}