How to set default form fields value from controller How to setup default form fields value from a form created in a controller?

I tryed to set the $form_state param but it does not work.

...
$form_state = new FormState();
$form_state-&gt;set('myfield_1', 'car');
$form_state-&gt;set('myfield_2', 'bus');
$form = $this-&gt;formBuilder-&gt;buildForm('Drupal\mymodule\Form\MyForm', $form_state);
return $form;
Add the default values to getForm():

return $this-&gt;formBuilder()-&gt;getForm('Drupal\mymodule\Form\MyForm', $default1, $default2);


And set the default values in the form class:

class MyForm extends FormBase {

  public function buildForm(array $form, FormStateInterface $form_state, $default1 = NULL, $default2 = NULL) {

    $form['field1'] = [
      '#type' =&gt; 'textfield',
      '#title' =&gt; $this-&gt;t('Field 1'),
      '#default_value' =&gt; $default1,
    ];

    // ...

  }
}