Could not format because the source could not be parsed:
line 189, column 17 of .: Expected to find ';'.
╷
189 │ List? transfer-encoding;
│ ^^^^^^^^
╵
line 89, column 11 of .: Expected to find ';'.
╷
89 │ String? CLOUD-ID;
│ ^^^^^
╵
line 92, column 17 of .: A function body must be provided.
╷
92 │ String? WEIBO-API-SECRET;
│ ^^^
╵
line 90, column 14 of .: Methods must have an explicit list of parameters.
╷
90 │ String? UAP-SID;
│ ^
╵
line 92, column 21 of .: A function body must be provided.
╷
92 │ String? WEIBO-API-SECRET;
│ ^^^^^^
╵
line 91, column 20 of .: Operator declarations must be preceded by the keyword 'operator'.
╷
91 │ String? WEIBO-API-KEY;
│ ^
╵
line 91, column 17 of .: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
╷
91 │ String? WEIBO-API-KEY;
│ ^^^
╵
line 91, column 16 of .: Operator declarations must be preceded by the keyword 'operator'.
╷
91 │ String? WEIBO-API-KEY;
│ ^
╵
line 91, column 21 of .: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
╷
91 │ String? WEIBO-API-KEY;
│ ^^^
╵
line 189, column 25 of .: Methods must have an explicit list of parameters.
╷
189 │ List? transfer-encoding;
│ ^
╵
(47 more errors...)
#0 DartFormatter.formatSource (package:dart_style/src/dart_formatter.dart:144)
#1 DartFormatter.format (package:dart_style/src/dart_formatter.dart:72)
#2 JsonToDartController.generateDart (package:json_to_dart/models/json_to_dart_controller.dart:147)
#3 _SettingWidgetState.build. (package:json_to_dart/pages/setting.dart:39)
#4 _TappedState.build. (package:json_to_dart/widget/tapped.dart:46)
原始json{
"request": {
"uri": "https://www.baidu.com/",
"headers": {
"CLOUDID": "jmu",
"CLOUD-ID": "jmu",
"UAP-SID": "a",
"WEIBO-API-KEY": "b",
"WEIBO-API-SECRET": "c",
"content-type": "application/json; charset=utf-8"
},
"query": {},
"data": null
},
"response": {
"statusCode": 200,
"headers": {
"connection": [
"keep-alive"
],
"content-type": [
"application/json"
],
"transfer-encoding": [
"d"
],
"date": [
"Thu, 13 Jan 2022 15:25:12 GMT"
],
"server": [
"nginx"
]
},
"data": {
"code": 401,
"msg": "bug"
}
}
}
错误原因