sendAttachment method

Future<void> sendAttachment(
  1. File file
)
override

Implementation

Future<void> sendAttachment(File file) async {
  try {
    final createdMessage = await clientService.createMessageAttachment(file);
    await localStorage.messagesDao.saveMessage(createdMessage);
    callbacks.onMessageSent?.call(createdMessage, file.path);
    if (clientService.connection != null && !_isListeningForEvents) {
      listenForEvents();
    }
  } on RuutClientException catch (e) {
    callbacks.onError
        ?.call(RuutClientException(e.cause, e.type, data: file.path));
  }
}