http请求返回值未获取所有数据
我正在处理http请求。突然在我的请求下,我得到的响应状态代码是200,这样我的api就可以工作了。。但是,在我的身体上,返回是不完整的。顺便说一下,这是我使用的资源http请求返回值未获取所有数据,http,flutter,dart,Http,Flutter,Dart,我正在处理http请求。突然在我的请求下,我得到的响应状态代码是200,这样我的api就可以工作了。。但是,在我的身体上,返回是不完整的。顺便说一下,这是我使用的资源 String APILink = "http://10.12.50.46:9191"; String compressedString2; Future<SuccessData> getSession() async { http.Response response2=await http.
String APILink = "http://10.12.50.46:9191";
String compressedString2;
Future<SuccessData> getSession() async {
http.Response response2=await http.post(
Uri.encodeFull(APILink+"/Mobile/StartSession"),
headers:{
"Auth-Key":"InSys-dev-key-001 ",
},body:compressedString2,
);
print("Compressed JSON:"+compressedString2);
print(response2.statusCode);
var dataGather2 = json.decode(response2.body);
print(response2.body);
}
这是我使用RESTAPI的实际响应
这是我在logcat上的打印数据:
如果您注意到,我在ResultSet上返回的数据不完整。。另外,其他数据也会被提取,如状态、错误消息和未查看标记。打印功能不会打印所有内容 您可以看到,在颤振运行输出中,颤振中的打印语句被截断 解决方案1: 从…起 您可以使用以下两个代码段 解决方案2: 在Android Studio调试模式下,在变量窗口中设置断点并复制变量内容
打印功能不会打印所有内容 您可以看到,在颤振运行输出中,颤振中的打印语句被截断 解决方案1: 从…起 您可以使用以下两个代码段 解决方案2: 在Android Studio调试模式下,在变量窗口中设置断点并复制变量内容
void logLongString(String s) {
if (s == null || s.length <= 0) return;
const int n = 1000;
int startIndex = 0;
int endIndex = n;
while (startIndex < s.length) {
if (endIndex > s.length) endIndex = s.length;
print(s.substring(startIndex, endIndex));
startIndex += n;
endIndex = startIndex + n;
}
}
void printWrapped(String text) {
final pattern = new RegExp('.{1,800}'); // 800 is the size of each chunk
pattern.allMatches(text).forEach((match) => print(match.group(0)));
}