requireLock method Null safety

Future requireLock()

Implementation

Future requireLock() async {
  for (var i = 0; i < 100; i++) {
    if (lock) {
      await Future.delayed(Duration(milliseconds: 5));
    } else {
      return;
    }
  }
  throw LockTimeoutException();
}