changeOwner method

Future<void> changeOwner(
  1. String groupId,
  2. String newOwner
)

Transfers the group ownership.

Only the group owner can call this method.

Param groupId The group ID.

Param newOwner The new owner ID.

Throws A description of the exception. See ChatError.

Implementation

Future<void> changeOwner(
  String groupId,
  String newOwner,
) async {
  Map req = {'groupId': groupId, 'owner': newOwner};
  Map result =
      await _channel.invokeMethod(ChatMethodKeys.updateGroupOwner, req);
  try {
    ChatError.hasErrorFromResult(result);
  } on ChatError catch (e) {
    throw e;
  }
}