|
|
|
@ -69,16 +69,15 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
logger.d(response.statusCode);
|
|
|
|
logger.d(response.statusCode);
|
|
|
|
print(response.body);
|
|
|
|
print(response.body);
|
|
|
|
if (response.statusCode == 204) {
|
|
|
|
if (response.statusCode == 204) {
|
|
|
|
print(null);
|
|
|
|
|
|
|
|
userChatHistory = [];
|
|
|
|
userChatHistory = [];
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
userChatHistory = getSingleUserChatintoModel(response.body);
|
|
|
|
userChatHistory = getSingleUserChatModel(response.body);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
isLoading = false;
|
|
|
|
isLoading = false;
|
|
|
|
notifyListeners();
|
|
|
|
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));
|
|
|
|
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 {
|
|
|
|
Future<void> onMsgReceived(List<Object?>? parameters) async {
|
|
|
|
List<SingleUserChatModel> data = [];
|
|
|
|
List<SingleUserChatModel> data = [];
|
|
|
|
for (dynamic msg in parameters!) {
|
|
|
|
for (dynamic msg in parameters!) {
|
|
|
|
data = getSingleUserChatintoModel(jsonEncode(msg));
|
|
|
|
data = getSingleUserChatModel(jsonEncode(msg));
|
|
|
|
logger.d(msg);
|
|
|
|
logger.d(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
userChatHistory.add(data.first);
|
|
|
|
userChatHistory.add(data.first);
|
|
|
|
|