PlatformUtilsImpl constructor

PlatformUtilsImpl()

Implementation

PlatformUtilsImpl() {
  Timer.periodic(Duration(milliseconds: 2000), (_) {
    if (_lastDeltaPing != null) {
      final difference = DateTime.now()
          .difference(_lastDeltaPing!)
          .abs()
          .inMilliseconds;

      isDeltaSynchronized.value = difference <= 2200;

      if (!isDeltaSynchronized.value) {
        Log.debug(
          'Delta not synchronized -> difference is $difference ms',
          '$runtimeType',
        );
      }
    }

    _lastDeltaPing = DateTime.now();
  });
}