# saveSettings method

void saveSettings(

1. BuildContext context,
2. {bool dispose = false}

)

## Implementation

    void saveSettings(BuildContext context, {bool dispose = false}) {
      plausible.event(name: "global_settings_saved");
      // Sync target ip setting _syncIpTextController
      if (_syncIpTextController.text.isNotEmpty) {
        prefs.setString("SyncIP", _syncIpTextController.text);
      }

      // Save repo link
      if (_repoTextController.text.isNotEmpty) {
        prefs.setString("RepoLink", _repoTextController.text);
      } else {
        prefs.setString("RepoLink", defaultRepoLink);
      }

      // Save docker repo link
      if (_dockerrepoController.text.isNotEmpty) {
        prefs.setString("DockerRepoLink", _dockerrepoController.text);
      } else {
        prefs.setString("DockerRepoLink", "https://registry-1.docker.io");
      }

      // Distro location setting
      if (_settings['Default Distro Location']!.text.isNotEmpty) {
        prefs.setString(
            "DistroPath", _settings['Default Distro Location']!.text);
      }
      _settings.forEach((key, value) {
        if (key != 'Default Distro Location' && value.text.isNotEmpty) {
          WSLApi().setConfig('wsl2', key, value.text);
        }
      });
      hasPushed = false;

      if (!dispose) {
        router.pushNamed('home');
      }
    }