single<T> static method
T?
single<T>({})
Creates a single-select searchable prompt.
Implementation
static T? single<T>({
required String title,
required List<T> items,
PromptTheme theme = PromptTheme.dark,
int maxVisible = 10,
String Function(T)? labelBuilder,
bool searchEnabled = true,
}) {
final prompt = SearchableListPrompt<T>(
title: title,
items: items,
theme: theme,
multiSelect: false,
maxVisible: maxVisible,
searchEnabled: searchEnabled,
);
final result = prompt.run(itemLabel: labelBuilder);
return result.isEmpty ? null : result.first;
}