safeCloseAll static method

Future<void> safeCloseAll(
  1. Map<String, Future<void> Function()> resources
)

Safely closes multiple resources

Implementation

static Future<void> safeCloseAll(
  Map<String, Future<void> Function()> resources,
) async {
  final futures = resources.entries.map((entry) =>
    safeClose(entry.value, entry.key)
  );
  await Future.wait(futures);
}