Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何在颤振中使用列表中的多个位置?_Flutter_Dart_Flutter Hive - Fatal编程技术网

Flutter 如何在颤振中使用列表中的多个位置?

Flutter 如何在颤振中使用列表中的多个位置?,flutter,dart,flutter-hive,Flutter,Dart,Flutter Hive,我正在尝试在我的应用程序中添加搜索逻辑。我有一个包含“标题”和“url”字段的列表。 我处理了这个问题,但我想同时搜索标题和url字段 ValueListenableBuilder<Box<Record>>( valueListenable: Boxes.getRecord().listenable(), builder: (context, box, _) { final records = box.values.to

我正在尝试在我的应用程序中添加搜索逻辑。我有一个包含“标题”和“url”字段的列表。 我处理了这个问题,但我想同时搜索标题和url字段

ValueListenableBuilder<Box<Record>>(
        valueListenable: Boxes.getRecord().listenable(),
        builder: (context, box, _) {
          final records = box.values.toList().cast<Record>();
          List<Record> filteredRecords = records
              .where((record) =>
                  record.title.containsIgnoreCase(_searchTextController.text))
              .toList();
          return buildContent(context, filteredRecords);
ValueListenableBuilder(
valueListenable:Box.getRecord().listenable(),
生成器:(上下文、框和){
最终记录=box.values.toList().cast();
列表过滤器记录=记录
.其中((记录)=>
record.title.containsSignoreCase(_searchTextController.text))
.toList();
返回构建内容(上下文、筛选器记录);

只需使用
(record.title+record.url).containsSignOreCase(\u searchTextController.text)
。基本上你是在添加它们,然后检查contains。非常感谢!