我有一个flutter 2.0.6
版本null safty
支持我在目录中创建了一个文件user.json
并在文件中assets/models
编写了以下代码:
{
"name": "",
"age": 0,
"friends": ["",""]
}
我运行了以下命令:
get generate model on home with assets/models/user.json
这个错误出现在我身上,我不知道解决方案是什么?
✖ + error_unexpected Could not format because the source could not be parsed:
line 4, column 3 of .: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
╷
4 │ List?<String> friends;
│ ^^^^
╵
line 4, column 3 of .: Expected to find ';'.
╷
4 │ List?<String> friends;
│ ^^^^
╵
line 4, column 17 of .: A function body must be provided.
╷
4 │ List?<String> friends;
│ ^^^^^^^
╵
line 4, column 17 of .: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
╷
4 │ List?<String> friends;
│ ^^^^^^^
╵
line 4, column 7 of .: The string '?' isn't a user-definable operator.
╷
4 │ List?<String> friends;
│ ^
╵
line 4, column 7 of .: Methods must have an explicit list of parameters.
╷
4 │ List?<String> friends;
│ ^
╵
line 4, column 7 of .: Operator declarations must be preceded by the keyword 'operator'.
╷
4 │ List?<String> friends;
│ ^
╵
line 4, column 8 of .: Types parameters aren't allowed when defining an operator.
╷
4 │ List?<String> friends;
│ ^^^^^^^^
╵
Time: 517 Milliseconds
'pub' is not recognized as an internal or external command,
operable program or batch file.