map<R> method

BindResult<R> map<R>(
  1. R mapper(
    1. T value
    )
)

A result holding the bound value transformed by mapper. When nothing was bound, mapper is not called and the result stays unbound.

final port = binder
    .bind('app.port', const ClassType<int>())
    .map((port) => port + 1)
    .orElse(8080);

Implementation

BindResult<R> map<R>(R Function(T value) mapper) => isBound
    ? BindResult<R>._(mapper(_value as T), isBound: true)
    : BindResult<R>._(null, isBound: false);