updateRecentChatAdapter method

Future<void> updateRecentChatAdapter(
  1. String jid
)

Implementation

Future<void> updateRecentChatAdapter(String jid) async {
  var index = _recentChats.indexWhere((element) =>
      element.jid == jid); // { it.jid ?: Constants.EMPTY_STRING == jid }
  var mainIndex = _mainrecentChats.indexWhere((element) =>
      element.jid == jid); // { it.jid ?: Constants.EMPTY_STRING == jid }
  if (jid.isNotEmpty) {
    var recent = await getRecentChatOfJid(jid);
    if (recent != null) {
      if (!index.isNegative) {
        _recentChats[index] = recent;
      }
      if (!mainIndex.isNegative) {
        _mainrecentChats[mainIndex] = recent;
      }
    }
  }
}