send static method
void
send(
- InviteContent? content,
- String channelId,
- dynamic onSuccess(),
- dynamic onCancel(),
- dynamic onFailure(),
Invite friends via a specified invite channel.
content
Custom content to override the default content provided from the Dashboard.
channelId
The channel through which the invite will be sent, one of the constants defined in {@link InviteChannelIds}.
onSuccess
Called when the invite process is complete.
onCancel
Called if a user canceled an invite.
onFailure
Called if operation failed.
Implementation
static void send(InviteContent? content, String channelId,
Function() onSuccess, Function() onCancel, Function(Error) onFailure) {
Map<String, dynamic> inviteBody = {
'channelId': channelId,
'content': content?.toJSON()
};
NativeBridge.async('Invites.send', jsonEncode(inviteBody)).then((value) {
if (value.isEmpty) {
onSuccess();
return;
}
jsonDecode(value)['result'] == 'cancel' ? onCancel() : onSuccess();
});
}