code that accepts text
Future<String> getListUsers(String request) async {
if (request != null) {
Socket socket;
await Socket.connect(ip, port).then((Socket sock) {
socket = sock;
}).then((_) {
socket.write('$request
');
return socket.first;
}).then((data) {
response = utf8.decode(data);
socket.close();
}).catchError((Object e) {
response = 'error';
});
} else {
response = 'error';
}
return response;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…