addChip method

void addChip(
  1. String value
)

adds the chip to the list, clear the text field and calls widget.onChanged

Implementation

void addChip(String value) {
  if (value.isEmpty || _hasReachedMaxChips) return;
  setState(() {
    chips.add(value.trim());
  });
  textCtrl.clear();
  widget.onChanged(chips.toList(growable: false));
}