1
I have an application in Fluter, and I have a return Json with List. I wanted to serialize the List to display it at a certain point, but I couldn’t find a way to do that. An example of my code:
class ResultLogin {
final String token;
final List<ZLoginResultSchema>schemas;
ResultLogin({this.token, this.schemas});
ResultLogin.fromJson(Map<String, dynamic> json):
token = json['token'],
schemas = new List.from( json['schemas']);
Map<String, dynamic> toJson() =>
{
'token': token,
'schemas': schemas,
};
}
My Class Zloginresultschema:
class ZLoginResultSchema {
final String name;
final String fullname;
ZLoginResultSchema({this.name, this.fullname});
ZLoginResultSchema.fromJson(Map<String, dynamic> json):
name = json['name'],
fullname = json['fullname'];
Map<String, dynamic> toJson() =>
{
'name': name,
'fullname': fullname,
};
}
In the ResultLogin.fromJson
token works, but the schema list does not, how to serialize a Json list?
Also enter your class code
ZLoginResultSchema
.– Julio Henrique Bitencourt
I added the code, sorry I forgot.
– Luan Martins Gepfrie
If the answer solved your problem mark it as accepted. :)
– Julio Henrique Bitencourt