Open
Description
I recently stumbled upon a use case where I could use a count down latch implementation.
However, I didn't find any such implementation in package:async
.
I propose we add one here.
In terms of API surface, all it needs to do in my opinion is the following:
- keep track of a "count" as a internal counter and as an internal stream of said counter
- provide a method to increment / decrement the latch
- provide a
Future<void> wait()
method, which is essentially anawait firstWhere((count) => count == 0);
- provide a
void reset();
which just resets the latch