add method
Adds delta, which may be negative, to the WaitGroup counter. If a wait Future is open and the counter becomes zero, the future is released. If the counter goes negative, it throws.
Implementation
void add([int amount = 1]) {
if (_counter + amount < 0) {
throw new StateError("WaitGroup counter cannot go negative.");
}
_counter += amount;
final completer = _completer;
if (_counter == 0 && completer != null) {
completer.complete();
}
}