如何从颤振中的列表中获取不同的 json 对象

时间:2021-01-15 23:49:07

标签: json flutter dart

我想从 flutter 和 dart 的列表中获取不同的 JSON 对象。我有一个像这样的 JSON 对象列表。我想从每个会话中获得一个基于密钥 time 最新的 JSON 对象。因此,根据与 Ronny 的关键对话和与 James 的关键对话获得一件物品。我坚持了几个小时。有人,请帮助我。我曾尝试使用 for 循环、set、compareTo 方法,但我仍然无法掌握它。谢谢!

  var data = [{"conversation_with":"ronny","text":"Hello","time":"1610673559273"}, {"conversation_with":"ronny","text":"Hi ronny","time":"1610673166335"}, {"conversation_with":"ronny","text":"how are you","time":"1610730464892"}, {"conversation_with":"ronny","text":"hi ronny","time":"1610673781584"}, {"conversation_with":"james","text":"Hello","time":"1610683918736"}, {"conversation_with":"james","text":"hi james","time":"1610683925522"}];

0 个答案:

没有答案