PrefsOption<T> constructor Null safety

PrefsOption<T>(
  1. String name,
  2. T value
)

Implementation

factory PrefsOption(String name, T value) {
  if (value is bool) {
    return BooleanOption(name, value) as PrefsOption<T>;
  } else if (value is int) {
    return IntegerOption(name, value) as PrefsOption<T>;
  } else if (value is String) {
    return StringOption(name, value) as PrefsOption<T>;
  }
  throw ArgumentError(
      'Only `bool`, `int` and `String` are valid parameter types.');
}