deleteInstance static method

Future<void> deleteInstance()

Closes the Ryuk TCP socket and removes the Ryuk container.

Resets the singleton so that getInstance will create a fresh instance on the next call. Used in test teardown to isolate test sessions.

Implementation

static Future<void> deleteInstance() async {
  _initFuture = null;
  final socket = _socket;
  if (socket != null) {
    await socket.close();
    _socket = null;
  }
  final container = _container;
  if (container != null) {
    try {
      await container.stop();
    } catch (e) {
      stderr.writeln('testcontainers: error stopping Ryuk container: $e');
    }
    _container = null;
  }
}