ping static method
Ping the request & get the ping duration
Implementation
static Future<Duration?> ping(Future<dynamic> Function() request) async {
final stopwatch = Stopwatch()..start();
try {
await request();
} catch (e) {
errorMessage = "ConnectivityChecker: Error to ping the request.\n$e";
log(errorMessage!);
return null;
}
stopwatch.stop();
return stopwatch.elapsed;
}