dispose method

Future<void> dispose()

Disposes of all locally registered instances that implement Disposable.

Implementation

Future<void> dispose() async {
  for (final res in _instances.values.toList()) {
    if (res is Disposable) {
      try {
        await res.dispose();
      } catch (_) {
        // In a framework, we should probably log this but not let it crash the request loop
      }
    }
  }
  _instances.clear();
}