setChannelAttributes method

Future<void> setChannelAttributes(
  1. String channelId,
  2. List<AgoraRtmChannelAttribute> attributes,
  3. bool enableNotificationToChannelMembers
)

Substitutes the channel attributes with new ones.

Implementation

Future<void> setChannelAttributes(
    String channelId,
    List<AgoraRtmChannelAttribute> attributes,
    bool enableNotificationToChannelMembers) async {
  List<Map<String, dynamic>> attributeList = [];
  for (final attr in attributes) {
    attributeList.add(attr.toJson());
  }
  final res = await _callNative("setChannelAttributes", {
    'channelId': channelId,
    "attributes": attributeList,
    "enableNotificationToChannelMembers": enableNotificationToChannelMembers,
  });
  if (res["errorCode"] != 0)
    throw AgoraRtmClientException(
        "setChannelAttributes failed errorCode:${res['errorCode']}",
        res['errorCode']);
}