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