孔洞逻辑完成
This commit is contained in:
@@ -19,22 +19,24 @@ class PathHttpDatasourceImpl implements PathHttpDatasource {
|
||||
// 1. 先打印基础信息
|
||||
print('=== 最终发送给后端的请求体 ===');
|
||||
print('请求体类型:${body.runtimeType}');
|
||||
print('是否包含holes:${body.containsKey('holes')}, holes长度:${(body['holes'] as List).length}');
|
||||
|
||||
// 2. 格式化打印JSON(带缩进,清晰展示嵌套结构)
|
||||
final jsonString = const JsonEncoder.withIndent(' ').convert(body);
|
||||
print('完整JSON请求体:\n$jsonString');
|
||||
|
||||
final _jsonString = jsonEncode(body);
|
||||
print('完整JSON请求体:\n$jsonString');
|
||||
|
||||
// 3. 可选:单独打印holes的JSON(重点关注)
|
||||
final holesJson = body['holes'] as List;
|
||||
print('=== 单独打印holes的JSON ===');
|
||||
if (holesJson.isEmpty) {
|
||||
print('holes 为空数组');
|
||||
} else {
|
||||
for (int i = 0; i < holesJson.length; i++) {
|
||||
print('第${i + 1}组hole:\n${const JsonEncoder.withIndent(' ').convert(holesJson[i])}');
|
||||
}
|
||||
}
|
||||
//final holesJson = body['holes'] as List;
|
||||
//print('=== 单独打印holes的JSON ===');
|
||||
//if (holesJson.isEmpty) {
|
||||
// print('holes 为空数组');
|
||||
//} else {
|
||||
// for (int i = 0; i < holesJson.length; i++) {
|
||||
// print('第${i + 1}组hole:\n${const JsonEncoder.withIndent(' ').convert(holesJson[i])}');
|
||||
// }
|
||||
//}
|
||||
} catch (e) {
|
||||
// 防止JSON序列化失败导致崩溃
|
||||
print('打印请求体失败:$e');
|
||||
|
||||
Reference in New Issue
Block a user