value property

T value

The setting's value.

Throws if WebSetting.isPresent is false.

Implementation

T get value {
  if (!isPresent) {
    throw StateError('Cannot access a value of an absent WebSetting');
  }
  assert(isPresent);
  // The intention of this getter is to return T whether it is nullable or
  // not whereas _value is of type T? since _value can be null even when
  // T is not nullable (when isPresent == false).
  //
  // We promote _value to T using `as T` instead of `!` operator to handle
  // the case when _value is legitimately null (and T is a nullable type).
  // `!` operator would always throw if _value is null.
  return _value as T;
}