totalUnreadCount is always 0
Which packages are you using?
stream_chat_flutter
On what platforms did you experience the issue?
Android
What version are you using?
7.1.0 flutter 3.22.0
What happened?
When I log the totalUnreadCount it's always 0 even when the user hasn't read the messages
Steps to reproduce
- with either of the following:
streamChatClient.state.totalUnreadCountStream.listen((count) {
logger().w('count: ${count.toString()}');
});
streamChatClient.on().listen((event) {
if (event.type == 'message.new') {
final unreadCount = streamChatClient.state.totalUnreadCount;
logger().w('unread messages count is now: $unreadCount');
}
});
-
Create two instances of the app
-
Send a message from one user
-
With the second user ensure no channel pages have yet been opened
Supporting info to reproduce
No response
Relevant log output
No response
Flutter analyze output
No issues
Flutter doctor output
[✓] Flutter (Channel stable, 3.22.0, on Ubuntu 22.04.4 LTS 6.5.0-28-generic, locale en_US.UTF-8)
• Flutter version 3.22.0 on channel stable at /home/john/dev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5dcb86f68f (3 weeks ago), 2024-05-09 07:39:20 -0500
• Engine revision f6344b75dc
• Dart version 3.4.0
• DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /home/john/Android/Sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /opt/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• Ubuntu clang version 14.0.0-1ubuntu1.1
• cmake version 3.22.1
• ninja version 1.10.1
• pkg-config version 0.29.2
[✓] Android Studio (version 2023.3)
• Android Studio at /opt/android-studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
[✓] VS Code (version 1.88.1)
• VS Code at /usr/share/code
• Flutter extension version 3.90.0
[✓] Connected device (3 available)
• sdk gphone x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)
• Linux (desktop) • linux • linux-x64 • Ubuntu 22.04.4 LTS 6.5.0-28-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.86
[✓] Network resources
• All expected network resources are available.
• No issues found!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
This issue is stale because it has been open for 20 days with no activity.
Has anyone looked into this? I want to show an unread message count and can't until this is fixed
Hey @Jonny1987, we were finalising the 7.3.0 issue so this got a bit delayed. Investigating this now.
This issue is stale because it has been open for 20 days with no activity.
Hi, is this still being looked into?
Hey @Jonny1987, apologies for the delay on this.
Can you confirm that read events are on for your channel type on the dashboard?
Hi @deven98 We have the same issue on 7.2.0 The toggle is on on dashboard
@sasha-bezpalchuk somehow the count works fine for me. Can you give me a minimal reproducible example so I can make sure the same works for me?
@deven98 I've double-checked and it works now. I assume you can close the issue, thanks
Perfect, thanks!