removeOption method Null safety

bool removeOption(
  1. String name
)

Remove the option named name from userPrefs. If lockedPrefs contains this option it will not be removed. Returns true if userPrefs was removed, false if it was not removed because userPrefs doesn't contain it because lockedPrefs contains it.

Implementation

bool removeOption(String name) {
  final option = _userPrefs.firstWhere((o) => o.name == name,
      orElse: () => InvalidOption(name));
  if (option is InvalidOption) {
    return false;
  }
  return _userPrefs.remove(option);
}