S? _nullableEvaluation<S, T>(S Function(T) f, T? nullableArgument) =>
nullableArgument == null ? null : f(nullableArgument);
Is there something in the dart language like the above, some built-in language feature? Not that it's hard to write yourself, just wondering if I'm reinventing the wheel to do something like the below.
import 'dart:convert';
void main() {
String? test = null;
print(_nullableEvaluation(utf8.encode, test));
test = "Test";
print(_nullableEvaluation(utf8.encode, test));
}