map<R extends Object> method
- @useResult
- R function(
- T value
Returns R
if this is not null. Otherwise returns null.
This function is similar to bind except that it returns R
instead of R?
String? foo = 'value';
foo.map((v) => 'other value'); // 'other value'
String? bar = null;
bar.map((v) => 'other value'); // null
Implementation
@useResult R? map<R extends Object>(R Function(T value) function) => this == null ? null : function(this!);