build method
Implementation
HeadlessListItemModel build(T value) {
final text = primaryText(value);
assert(text.trim().isNotEmpty);
final source = searchText?.call(value) ?? text;
final normalizedText = HeadlessTypeaheadLabel.normalize(text);
final normalizedSource = HeadlessTypeaheadLabel.normalize(source);
final typeaheadLabel =
normalizedSource.isEmpty ? normalizedText : normalizedSource;
return HeadlessListItemModel(
id: id(value),
primaryText: text,
typeaheadLabel: typeaheadLabel,
isDisabled: isDisabled?.call(value) ?? false,
semanticsLabel: semanticsLabel?.call(value),
leading: leading?.call(value),
title: title?.call(value),
subtitle: subtitle?.call(value),
trailing: trailing?.call(value),
features: features?.call(value),
);
}