send method

Future<Either<BaseException, void>> send({
  1. required String chatId,
  2. required String localId,
  3. required String scope,
  4. String? message,
  5. String? fileId,
})

Implementation

Future<Either<BaseException, void>> send({
  required String chatId,
  required String localId,
  required String scope,
  String? message,
  String? fileId,
}) async {
  try {
    final args = [
      chatId,
      {
        "scope": scope,
        "localId": localId,
        "message": ?message,
        "fileId": ?fileId,
      },
    ];

    SeedKitLoggerService.i('Hub Send: method=$sendMessageKey, args=$args');

    await _controller?.invoke(
      sendMessageKey,
      args: args,
    );

    SeedKitLoggerService.i('Hub Sended: $args');

    return const Right(null);
  } catch (e, s) {
    SeedKitLoggerService.i('Hub Send error: $e');

    return ErrorHandler.fromError(e, stackTrace: s);
  }
}