transform<S> method
Transforms the Optional value.
If the Optional is absent(), returns absent() without applying the transformer.
The transformer must not return null
. If it does, an ArgumentError is thrown.
Implementation
Optional<S> transform<S>(S Function(T value) transformer) {
return _value == null
? Optional<S>.absent()
: Optional<S>.of(transformer(_value));
}