requestToJoinPublicGroup method
Requests to join a group.
This method works only for public groups requiring authentication, i.e., groups with the style of ChatGroupStyle.PublicJoinNeedApproval.
Param groupId
The group ID.
Param reason
The reason for requesting to join the group.
Throws A description of the exception. See ChatError.
Implementation
Future<void> requestToJoinPublicGroup(
String groupId, {
String? reason,
}) async {
Map req = {'groupId': groupId};
req.putIfNotNull('reason', reason);
Map result = await _channel.invokeMethod(
ChatMethodKeys.requestToJoinPublicGroup, req);
try {
ChatError.hasErrorFromResult(result);
} on ChatError catch (e) {
throw e;
}
}