getUnreadCount static method

Future<void> getUnreadCount(
  1. int conversationType,
  2. String targetId,
  3. dynamic finished(
    1. int? count,
    2. int? code
    )?
)

获取单个会话的未读数

conversationType 会话类型,参见枚举 RCConversationType

targetId 会话 id

finished 回调结果,code 为 0 代表正常

Implementation

static Future<void> getUnreadCount(int conversationType, String targetId, Function(int? count, int? code)? finished) async {
  Map map = {"conversationType": conversationType, "targetId": targetId};
  Map? unreadMap = await _channel.invokeMethod(RCMethodKey.GetUnreadCountTargetId, map);
  if (finished != null) {
    finished(unreadMap!["count"], unreadMap["code"]);
  }
}