setOption method Null safety

bool setOption(
  1. PrefsOption option
)

Add an option or replace an option if one already exists with the same name. If option exists in lockedPrefs it will not be added. Returns true if userPrefs was updated, false otherwise.

Implementation

bool setOption(PrefsOption option) {
  if (lockedPrefs.contains(option)) {
    print('Option "${option.name}" (${option.value}) is locked and therefore '
        'ignored');
    return false;
  }
  _userPrefs.add(option);
  return true;
}