transform<S extends Object> 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 extends Object>(S transformer(T value)) {
return _value == null
? Optional<S>.absent()
: Optional<S>.of(transformer(_value!));
}