Change record status: 
Project: 
Introduced in branch: 
8.2.x
Introduced in version: 
8.2.0
Description: 

Because of the configuration system, there is no reason for ThemeHandler::setDefault() to exist. Instead of calling setDefault, use the config system to modify the system.theme config directly.

Before:

\Drupal::service('theme_handler)->setDefault('bartik');

After:

\Drupal::configFactory()->getEditable('system.theme')->set('default', 'bartik')->save();
Impacts: 
Site builders, administrators, editors
Themers