Optional<T>.of constructor

Optional<T>.of(T value)

Constructs an Optional of the given value.

Throws ArgumentError if value is null.

Implementation

Optional.of(T value) : this._value = value {
  if (this._value == null) throw new ArgumentError('Must not be null.');
}