timedAsync<R> function
Implementation
Future<R> timedAsync<R>(FutureOr<R> block(),
{dynamic result(R result, Duration time)?}) async {
result ??= (R result, Duration time) {
print("Duration: $time");
};
final start = DateTime.now();
R r = await block();
final duration = DateTime.now().difference(start);
final handled = result(r, duration);
return handled is R ? handled : r;
}