resetEngine function
Drops the cached client, closing it if there is one to close.
Clearing the cache is the whole job, so a cached attempt that had already failed is discarded quietly rather than rethrown: a caller reaching for this is recovering from that failure, not asking to see it again.
Implementation
Future<void> resetEngine() async {
final existing = _pending;
_pending = null;
if (existing == null) return;
try {
await (await existing).close();
} on Object {
// Nothing to close, and nothing useful to say about a failure the caller
// has already seen once.
}
}