closeAll method

  1. @override
void closeAll()

Implementation

@override
void closeAll() {
  // Create a copy of the values to avoid ConcurrentModificationException
  final instancesToClose = List<IShspInstance>.from(_instances.values);
  _instances.clear();

  // Close all instances after clearing the map
  for (final instance in instancesToClose) {
    try {
      instance.close();
    } catch (e) {
      // Log error but continue closing other instances
      print('Error closing instance: $e');
    }
  }
}