let<R> method
R
let<R>(
- R f(
- T it
Returns the result of giving this value to f
.
This method is for single values what the map
method is for collections.
Example
With this method, this snippet:
String? urlString = Platform.environment['url'];
Uri? url = urlString == null ? null : Uri.parse(urlString)
can be rewritten like this:
Uri? url = Platform.environment['url']?.let(Uri.parse)
Implementation
R let<R>(R Function(T it) f) => f(this);