Optional<T>.of constructor
Optional<T>.of (
- T value
Creates a new Optional with the given non-null value.
Throws ArgumentError if value is null.
Implementation
factory Optional.of(T value) {
if (value == null) {
throw ArgumentError('value must be non-null');
} else {
return _Present<T>(value);
}
}