Skip to content

Commit 9391452

Browse files
committed
workaround: silent json error
1 parent b2d906c commit 9391452

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/stream_chat/lib/src/core/api/channel_api.dart

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'package:stream_chat/src/core/models/channel_state.dart';
88
import 'package:stream_chat/src/core/models/event.dart';
99
import 'package:stream_chat/src/core/models/filter.dart';
1010
import 'package:stream_chat/src/core/models/message.dart';
11+
import 'package:flutter/foundation.dart';
1112

1213
/// Defines the api dedicated to channel operations
1314
class ChannelApi {
@@ -79,7 +80,13 @@ class ChannelApi {
7980
}),
8081
},
8182
);
82-
return QueryChannelsResponse.fromJson(response.data);
83+
84+
try {
85+
return QueryChannelsResponse.fromJson(response.data);
86+
} catch (e) {
87+
debugPrint('queryChannels error: $e');
88+
return QueryChannelsResponse.fromJson({});
89+
}
8390
}
8491

8592
/// Mark all channels for this user as read

0 commit comments

Comments
 (0)