also method
T
also(
- void f(
- T it
Returns this value after calling f
with it.
Example
With this method, this snippet:
final message = 'Hello World';
print(message);
return message;
can be rewritten like this:
return 'Hello World'.also(print);
Implementation
T also(void Function(T it) f) {
f(this);
return this;
}