close method

Future<void> close()

Removes the network; its containers must have stopped. A network that was never created, could not be created, or is gone, is no error.

Implementation

Future<void> close() async {
  final pending = _id;
  final docker = _docker;
  _id = null;
  if (pending == null || docker == null) {
    return;
  }
  final String id;
  try {
    id = await pending;
  } on Object {
    // Its creation was under way and failed: there is nothing to
    // remove, and who asked for the network has the error.
    return;
  }
  await docker.removeNetwork(id);
}