Skip to content

Commit 8532a05

Browse files
committed
handling
1 parent 8153525 commit 8532a05

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/controllers/chat_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ChatController extends ChangeNotifier {
7878
}
7979

8080
List<String> rootIds = data
81-
.where((msg) => msg['parent'] == null)
81+
.where((msg) => !msg.containsKey('parent') || msg['parent'] == null)
8282
.map((msg) => msg['id'] as String).toList();
8383

8484
_chats.clear();

lib/utilities/chat_messages.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class ChatMessage extends ChangeNotifier {
7373

7474
factory ChatMessage.fromMapList(List<Map<String, dynamic>> mapList, [ValueKey<String>? id]) {
7575
id ??= ValueKey<String>(mapList.firstWhere(
76-
(map) => map['parent'] == null,
76+
(map) => !map.containsKey('parent') || map['parent'] == null,
7777
orElse: () => throw ArgumentError('No root found in mapList'),
7878
)['id']);
7979

0 commit comments

Comments
 (0)