【问题标题】:How to show list in flutter whose id matches如何在 id 匹配的颤动中显示列表
【发布时间】:2021-12-22 22:45:39
【问题描述】:

我有两个数据列表存储在

  1. final profiles = context.watch<ProfilesBloc>().state.profiles;
  2. final users= context.watch<UsersBloc>().state.users;

我想用唯一的 profile.id 与 user.id 匹配的人来构建列表 我试过 if (user.id == profiles.id) 但它不工作 有什么帮助吗?

【问题讨论】:

    标签: flutter dart flutter-layout flutter-test


    【解决方案1】:

    var newUser = users.where((user) =&gt; user.id.toLowerCase().contains(profiles.id.toLowerCase()).toList();

    您基本上可以使用此方法检查条件以创建新列表。随意根据您的要求更改代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-17
      • 2020-12-26
      • 2020-12-12
      • 2021-11-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多