8 – How do I pass dynamic parameters to a service?

Is it possible to pass dynamic parameters when calling a service?


    class: DrupalservicesDefaultService
    arguments: ('@entity_type.manager')


namespace Drupalmy_module;
use DrupalCoreEntityEntityTypeManagerInterface;

 * Class DefaultService.
class DefaultService implements DefaultServiceInterface {

   * DrupalCoreEntityEntityTypeManagerInterface definition.
   * @var DrupalCoreEntityEntityTypeManagerInterface
  protected $entityTypeManager;

  private $myValue;

   * Constructs a new DefaultService object.
  public function __construct(EntityTypeManagerInterface $entity_type_manager) {
    $this->entityTypeManager = $entity_type_manager;

    //how set $myValue?
    // $this->myValue = ???


Is there a way to dynamically set myValue when calling this service, for example while calling the service from hook_ENTITY_TYPE_update(), passing the $entity->id() value?

I’ve found similar questions, such as How do I pass parameters to a service? or Create service with argument, but they don’t answer my problem.