close method

  1. @override
Future close()
override

Disposes of this client.

Implementation

@override
Future close() {
  receivePort.close();

  for (var c in _onConnect) {
    if (!c.isCompleted) {
      c.completeError(StateError(
          'The client was closed before the server ever accepted the connection.'));
    }
  }

  for (var c in _requests.values) {
    if (!c.isCompleted) {
      c.completeError(StateError(
          'The client was closed before the server responded to this request.'));
    }
  }

  for (var s in _subscriptions) {
    s._close();
  }

  _requests.clear();
  return Future.value();
}