init method

void init({
  1. String? targetIp,
  2. int? targetPort,
  3. Duration? interval,
  4. Duration? timeout,
})

Initialize the ping service with custom settings. If not called, defaults to pinging Google DNS (8.8.8.8:443) every 2 seconds.

Implementation

void init({
  String? targetIp,
  int? targetPort,
  Duration? interval,
  Duration? timeout,
}) {
  if (targetIp != null) _targetIp = targetIp;
  if (targetPort != null) _targetPort = targetPort;
  if (interval != null) _interval = interval;
  if (timeout != null) _timeout = timeout;
}