如何在 Dart 中进行查询搜索?
How to do a query search in Dart?
我需要在列表中按查询进行搜索
像这样:
final List<String> products = ['apple', 'ball', 'mouse', 'smartphone'];
List<String> search(){
//All the code
}
List<String> products = ['apple', 'ball', 'mouse', 'smartphone'];
List<String> search(String inputText){
//All the code
var result = products.where((product) =>
product.toLowerCase().contains(inputText.toLowerCase());
return result;
}
我需要在列表中按查询进行搜索
像这样:
final List<String> products = ['apple', 'ball', 'mouse', 'smartphone'];
List<String> search(){
//All the code
}
List<String> products = ['apple', 'ball', 'mouse', 'smartphone'];
List<String> search(String inputText){
//All the code
var result = products.where((product) =>
product.toLowerCase().contains(inputText.toLowerCase());
return result;
}