callAsync<T> method
Execute async callback if token is available.
Implementation
Future<T?> callAsync<T>(Future<T> Function() callback,
[int tokens = 1]) async {
if (tryAcquire(tokens)) {
return await callback();
}
return null;
}