send static method

void send(
  1. InviteContent? content,
  2. String channelId,
  3. dynamic onSuccess(),
  4. dynamic onCancel(),
  5. dynamic onFailure(
    1. Error
    ),
)

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();
  });
}