setValid method

void setValid(
  1. String newValue
)

Implementation

void setValid(String newValue) {
  if (newValue.length == 3) {
    if (newValue.contains("/")) {
      _cardValid = newValue.substring(0, 2);
    } else {
      _cardValid = newValue.substring(0, 2) + "/" + newValue.substring(2);
    }
  } else {
    _cardValid = newValue;
  }
  notifyListeners();
}