如何解决Flutter:Get_Cli / 无法在使用 get_cli 1.5.0 的 Flutter 中生成用户模型代码
我有 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','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.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。