resolveSelectedValue method
Implementation
void resolveSelectedValue(SearchFieldSource result) {
if (result == null) return;
if (!mounted) return;
String selected;
selectedResult = result;
setState(() {
widget.selectedValue = result.value;
});
var resolvedWrapedLabel = result.label.replaceAll('\n', ' - ');
selected = (result.subtitle.isEmpty)
? (resolvedWrapedLabel)
: (resolvedWrapedLabel + ' - ' + result.subtitle);
_controller.text = selected;
widget.selectedText = selected;
if (widget.onSelect != null) {
widget.onSelect!(widget.selectedValue);
}
}