sleepMS method

void sleepMS(
  1. int waitingTime, [
  2. bool infoB = false
])

Sleep method with time and optional infoB boolean for info-printing. the parameter infoB can't cant have a value 'null' because of its tye, but implicit default value = null try adding explicit non-null default value or the 'required' modifier OK Done void sleepMS(int waitingTime, bool infoB) { callers: No usages found

Implementation

void sleepMS(int waitingTime, [bool infoB = false]) {
//  var testSleepTime = new Duration(hours:0, minutes:0, seconds:0, microseconds:500);
  var goalTime =
      new DateTime.now().add(new Duration(milliseconds: waitingTime));
  bool _infoB = infoB;
  if (_infoB) (print('Waiting for  $waitingTime'));
  do {
    //  var timeNow = new DateTime.now();
  } while (new DateTime.now().compareTo(goalTime) < 0);
  if (_infoB) (print('waiting time over over'));
}