map<B> abstract method
Change the value of type T
to a value of type B
using function f
.
/// Change type `String` (`T`) to type `int` (`B`)
final Option<String> mStr = Option.of('name');
final Option<int> mInt = mStr.map((a) => a.length);
👇
[🥚].map((🥚) => 👨🍳(🥚)) -> [🍳]
[_].map((🥚) => 👨🍳(🥚)) -> [_]
Implementation
@override
Option<B> map<B>(B Function(T t) f);