fluttercandies / JsonToDart

The tool to convert json to dart code, support Windows,Mac,Web.
MIT License
355 stars 42 forks source link

数据不符合dart的命令规范 #17

Closed MrDgbot closed 2 years ago

MrDgbot commented 2 years ago

原始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" } } }
错误原因

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)
zmtzawqlp commented 2 years ago

数字字母下划线,还有其他什么规则吗

zmtzawqlp commented 2 years ago

close with v1.4.1