setAllMessagesRead method

Future<int?> setAllMessagesRead()

Mark all messages in conversation as read.

Returns an updated unread message count for the user on this conversation.

Implementation

Future<int?> setAllMessagesRead() async {
  if (!hasMessages) {
    return null;
  }
  try {
    final result =
        await TwilioConversations().conversationApi.setAllMessagesRead(sid);
    return result.count;
  } on PlatformException catch (err) {
    throw TwilioConversations.convertException(err);
  }
}