how to pass the query parameters as default values in buildForm?
there might be a better method as suggested in the comments.
I replaced 

    $params = drupal_get_query_parameters();


by 

    $params=\Drupal::request()-&gt;query-&gt;all();