Chat Search User Api Implementation

merge-requests/22/head
Aamir Muhammad 3 years ago
parent d4b31d4338
commit 05c6cc7f14

@ -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<SingleUserChatModel> getSingleUserChatintoModel(String str) => List<SingleUserChatModel>.from(json.decode(str).map((x) => SingleUserChatModel.fromJson(x)));
List<SingleUserChatModel> getSingleUserChatModel(String str) => List<SingleUserChatModel>.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<void> onMsgReceived(List<Object?>? parameters) async {
List<SingleUserChatModel> data = [];
for (dynamic msg in parameters!) {
data = getSingleUserChatintoModel(jsonEncode(msg));
data = getSingleUserChatModel(jsonEncode(msg));
logger.d(msg);
}
userChatHistory.add(data.first);

Loading…
Cancel
Save