resolveSelectedValue method

void resolveSelectedValue(
  1. List<SearchFieldSource> result
)

Implementation

void resolveSelectedValue(List<SearchFieldSource> result) {
  selectedResult = result;
  setState(() {
    widget.selectedValue = result;
  });

  String selectedString = "";

  for (int i = 0; i < result.length; i++) {
    var label = result[i].label;

    if (i + 1 == result.length) {
      selectedString += "$label";
    } else {
      selectedString += "$label, ";
    }
  }

  _controller.text = selectedString;

  if (widget.onSelect != null) widget.onSelect!(widget.selectedValue);
}