map<U> abstract method

  1. @useResult
Option<U> map<U>(
  1. U map(
    1. T value
    )
)

Transforms the contained value, if any, by applying map to it.

Examples

// prints "Some(some: 2)"
print(const Some(2).map((value) => 'some: $value'));

// prints "None"
print(const None<int>().map((value) => 'some: $value'));

Implementation

@useResult
Option<U> map<U>(U Function(T value) map);