clearClosables method
Clears and closes the provided collection of closables and removes them
from the attached set. This method is used during the onClose
operation.
Implementation
void clearClosables(
List<AutoClosable> closables,
Set<AutoClosable> attachedSet,
) {
for (final closable in closables) {
if (closable.isClosed != true) {
unawaited(_callCloser(closable));
}
final wasRemoved = attachedSet.remove(closable);
assert(wasRemoved, 'check if entity wasn`t removed twice');
}
closables.clear();
}