beforeExit method
Invokes the beforeExit
callbacks of all Resources that had one.
Implementation
Future<void> beforeExit() async {
await Future.wait(_resourcesWithBeforeExit.map((r) async {
return r._userBeforeExit?.call();
}));
_resourcesWithBeforeExit.clear();
}