acquire method

Future acquire()

Acquires a permit from this semaphore, asynchronously blocking until one is available.

Implementation

Future acquire() {
  var completer = new Completer();
  if (_counter + 1 <= maxCount) {
    _counter++;
    completer.complete();
  } else {
    _waitQueue.add(completer);
  }
  return completer.future;
}