let
R
let<
Apply function op to this value and return the result.
This is useful for chaining operations and avoiding temporary variables. Also known as the "let" operation in Kotlin or "tap" in other languages.
Parameters:
op: Function that transforms this value into a result of typeR
Returns: The result of calling op with this value
Example:
final length = 'hello world'
.let((s) => s.split(' '))
.let((words) => words.length); // Returns: 2
// Instead of:
final text = 'hello world';
final words = text.split(' ');
final length = words.length;
Implementation
R let<R>(R Function(T) op) => op(this);