Возвращает сообщение SocketException или null.
SocketException
null
String? socketMessage(Object? error) => error is SocketException ? error.message : null;