sendAction method

Future<SendActionResponse> sendAction(
  1. Message message,
  2. Map<String, dynamic> formData
)

Send action for a specific message of this channel.

Implementation

Future<SendActionResponse> sendAction(
  Message message,
  Map<String, dynamic> formData,
) async {
  _checkInitialized();
  final messageId = message.id;
  final res = await _client.sendAction(id!, type, messageId, formData);

  // update the passed message with response message
  if (res.message != null) {
    state!.updateMessage(res.message!);
  } else {
    // remove the passed message if response does
    // not contain message
    state!.removeMessage(message);
  }
  return res;
}