updateChat method

Future<void> updateChat(
  1. ChatModel chat
)

Implementation

Future<void> updateChat(ChatModel chat) {
  var index = _chats.indexWhere((element) => element.id == chat.id);
  _chats[index] = chat;
  _chatsController.addStream(Stream.value(_chats));
  notifyListeners();
  debugPrint('Chat updated: $chat');
  return Future.value();
}