setPersistSelection method

Future<void> setPersistSelection(
  1. bool persist
)

Changes the persist mode at runtime.

  • Setting to true: saves the current environment immediately so the next launch restores it.
  • Setting to false: clears the stored selection so the next launch always starts from defaultEnv; future switches are not saved.

Implementation

Future<void> setPersistSelection(bool persist) async {
  _persistSelection = persist;
  if (persist) {
    await _store.save(current.name);
  } else {
    await _store.clear();
  }
}