From 05c6cc7f140a270b0b22c7ec848afa8a0370959b Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Wed, 19 Oct 2022 09:56:03 +0300 Subject: [PATCH] Chat Search User Api Implementation --- lib/api/chat/chat_provider_model.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/api/chat/chat_provider_model.dart b/lib/api/chat/chat_provider_model.dart index fe95696..ea6ea13 100644 --- a/lib/api/chat/chat_provider_model.dart +++ b/lib/api/chat/chat_provider_model.dart @@ -69,16 +69,15 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { logger.d(response.statusCode); print(response.body); if (response.statusCode == 204) { - print(null); userChatHistory = []; } else { - userChatHistory = getSingleUserChatintoModel(response.body); + userChatHistory = getSingleUserChatModel(response.body); } isLoading = false; notifyListeners(); } - List getSingleUserChatintoModel(String str) => List.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x))); + List getSingleUserChatModel(String str) => List.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x))); ChatUserModel userToList(String str) => ChatUserModel.fromJson(json.decode(str)); @@ -195,7 +194,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { Future onMsgReceived(List? parameters) async { List data = []; for (dynamic msg in parameters!) { - data = getSingleUserChatintoModel(jsonEncode(msg)); + data = getSingleUserChatModel(jsonEncode(msg)); logger.d(msg); } userChatHistory.add(data.first);