close method
Close this connection gracefully
This is an error to use this connection after connection has been closed
Implementation
Future<void> close() async {
final packet = MySQLPacket(
sequenceID: 0,
payload: MySQLPacketCommQuit(),
payloadLength: 0,
);
if (_state != _MySQLConnectionState.connectionEstablished) {
throw MySQLClientException(
"Can not close connection. Connection state is not in connectionEstablished state",
);
}
_socket.add(packet.encode());
_state = _MySQLConnectionState.quitCommandSend;
await _closeSocketAndCallHandlers();
}