track<T> static method

Future<T> track<T>(
  1. Future<T> apiCall
)

Implementation

static Future<T> track<T>(Future<T> apiCall) async {

  final stopwatch = Stopwatch()..start();

  final result = await apiCall;

  stopwatch.stop();

  final latency = stopwatch.elapsedMilliseconds;

  debugPrint("API Latency: $latency ms");

  return result;

}