sendMessage method

Future<void> sendMessage(
  1. String text, {
  2. SendMessageOptions? options,
})

Sends a text message in a given conversation.

Implementation

Future<void> sendMessage(String text, {SendMessageOptions? options}) {
  _createConversation();

  if (options != null) {
    _session.execute(
        'conversations["${id}"].sendMessage("$text", ${json.encode(options)});');
  } else {
    _session.execute('conversations["${id}"].sendMessage("$text");');
  }

  // We return a Future, because we expect to refactor this code to use the Data Layer,
  // and handle failures as well.
  return Future<void>.value();
}