close method

  1. @override
Future<void> close()
override

Implementation

@override
Future<void> close() async {
  try {
    await _socket?.sink.close();
  } catch (_) {}

  // Close the controllers to prevent further messages and race conditions
  try {
    await _inputController?.close();
  } catch (_) {}
  try {
    await _outputController?.close();
  } catch (_) {}

  _inputController = null;
  _outputController = null;
  _channel = null;
  _socket = null;
}