/ SDKs / Flutter
SDKs
Chat SDKs Flutter v3
Chat SDKs Flutter
Chat SDKs
Flutter
Version 3
Sendbird Chat SDK v3 for Flutter is no longer supported as a new version is released. Check out our latest Chat SDK v4

Add or remove a user event handler

Copy link

To receive information about events related to users connected to the Sendbird server, add a user event handler with its unique user-defined ID by calling addUserUserEventHandler().

If you want to stay informed of changes related to users and notify users' client apps of these changes, define and register multiple user event handlers to each view controller.


User event types

Copy link

List of user events

Copy link

To add or remove onTotalUnreadMessageCountUpdated(), visit this page and contact us on the Sendbird Dashboard.

MethodInvoked whenNotified devices

onTotalUnreadMessageCountUpdated()

A user has read messages in the joined group channels and there is an update on the total number of the user's unread messages.

The user's devices with running client apps. The devices will be notified with the total number of unread messages along with a collection of the number of unread messages by custom channel type.


Add a user event handler

Copy link

The following code shows a full set of supported event callbacks with their parameters and how to add a user event handler to the unique SendbirdSdk instance.

class MyClass with UserEventHandler {
    // Add this class via sendbird.addUserEventHandler(UNIQUE_HANDLER_ID, this).
    // Remove it through sendbird.removeUserEventHandler(UNIQUE_HANDLER_ID) when it's no longer needed.

    @override
    void onTotalUnreadMessageCountUpdated(int totalCount, Map<String, num> customTypesCount) {

    }
}

Remove a user event handler

Copy link

The following code shows how to remove the user event handler.

sendbird.removeUserEventHandler(UNIQUE_HANDLER_ID);