let<R extends Object?> method

R let<R extends Object?>(
  1. R block(
    1. T value
    )
)

Transforms this value using block and returns the result.

The block receives this value and can return any type R. Use this for value transformations in a fluent, readable style.

Example:

final user = userData
  .let((data) => User.fromJson(data))
  .let((user) => user.copyWith(verified: true));

Implementation

R let<R extends Object?>(R Function(T value) block) => block(this);