我正在尝试将Json转换为PODO(Dart模型类),但出现以下错误:
[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
FormatException: Unexpected character (at character 2)
答案 0 :(得分:0)
模型类
class FormModel {
final String id;
final String name;
FormModel({this.id, this.name});
factory FormModel.fromJSON(dynamic data) {
return FormModel(id: data["id"], name: data["name"]);
}
}
通过JSON创建对象
FormModel form = FormModel.fromJSON(jsonData);