addAdmin method Null safety

Future<void> addAdmin(
  1. String groupId,
  2. String memberId
)

Adds a group admin.

Only the group owner can call this method and group admins cannot.

Param groupId The group ID.

Param memberId The username of the admin to add.

Return The updated group instance.

Throws A description of the exception. See {@link EMError}.

Implementation

Future<void> addAdmin(
  String groupId,
  String memberId,
) async {
  Map req = {'groupId': groupId, 'admin': memberId};
  Map result = await _channel.invokeMethod(ChatMethodKeys.addAdmin, req);
  try {
    EMError.hasErrorFromResult(result);
  } on EMError catch (e) {
    throw e;
  }
}