onItemUpdated method

  1. @override
void onItemUpdated(
  1. Conversation oldItem,
  2. Conversation newItem,
  3. List<Conversation> updatedList
)
override

Called when a conversation is updated in the list.

Implementation

@override
void onItemUpdated(
    Conversation oldItem,
    Conversation newItem,
    List<Conversation> updatedList,
    ) {
  // OPTIMIZATION: No map update needed - index unchanged, ID unchanged
  // Only update map if conversationId changed (rare edge case)
  if (oldItem.conversationId != newItem.conversationId) {
    final index = _findConversationIndex(oldItem.conversationId);
    _removeFromIndexMap(oldItem.conversationId);
    if (index != null) {
      _addToIndexMap(newItem.conversationId, index);
    }
  }

  if (!isClosed) {
    add(_ListItemUpdated(updatedList));
  }
}