let<R> method

R? let<R>(
  1. R block(
    1. T it
    )
)

Executes block if value is not null and returns the result Usage: user?.let((it) => it.name) ?? 'Guest'

Implementation

R? let<R>(R Function(T it) block) {
  final self = this;
  if (self != null) return block(self);
  return null;
}