Skip to content

Commit 1bbdaa9

Browse files
committed
(ConversationList): Fix runtime type error
The code throws the runtime error: `type '(Map<String, dynamic>) => UserData' is not a subtype of type '(dynamic) => dynamic' of 'f'` I have tried to understand the rules around Dart's type system but I have been unsuccessful. So for now I'll just revert this. Signed-off-by: Victor Omondi <victor@slick.co.ke>
1 parent 0da9f92 commit 1bbdaa9

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.17.3
2+
3+
- Fix runtime type error when triggering `onSelectConversation`.
4+
15
## 0.17.2
26

37
- Fix missing `params` property from `ConversationActionEvent` and `MessageActionEvent`.

lib/src/conversationlist.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ class SelectConversationEvent {
2828
SelectConversationEvent.fromJson(Map<String, dynamic> json)
2929
: conversation = ConversationData.fromJson(json['conversation']),
3030
me = UserData.fromJson(json['me']),
31-
others = json['others'].map(UserData.fromJson).toList();
31+
others = json['others']
32+
.map<UserData>((user) => UserData.fromJson(user))
33+
.toList();
3234
}
3335

3436
class ConversationListOptions {
@@ -326,6 +328,11 @@ class ConversationListState extends State<ConversationList> {
326328
print('📗 conversationlist._jscSelectConversation: $message');
327329
}
328330

331+
final x = json.decode(message);
332+
print('conversation: ${x['conversation']}');
333+
print('me: ${x['me']}');
334+
print('others: ${x['others']}');
335+
329336
widget.onSelectConversation?.call(
330337
SelectConversationEvent.fromJson(json.decode(message)),
331338
);

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: talkjs_flutter
22
description: Official TalkJS SDK for Flutter
3-
version: 0.17.2
3+
version: 0.17.3
44
homepage: https://talkjs.com
55

66
environment:

0 commit comments

Comments
 (0)