I am new to both Flutter and Dart and trying to convert some android studio application to use flutter if I can. I am trying to parse some simple json to learn how all of the dart/flutter features can help me.
The class structure that I want to write to is:
class Company extends Salinas {
final String name;
Company({this.name}) : super();
factory Company.fromJson(Map<String, dynamic> json) => _$CompanyFromJson(json);
Map<String, dynamic> toJson() => _$CompanyToJson(this);
}
class Salinas {
final int id;
Salinas({this.id});
factory Salinas.fromJson(Map<String, dynamic> json) => _$SalinasFromJson(json);
Map<String, dynamic> toJson() => _$SalinasToJson(this);
}
the json string is simple
{"id":1,"name":"Acme"}
and:
print(company.id)is null
print(company.name) is Acme;
when I look at the Company.g.dart file there is no reference to the extended class Salinas? is there a way to do this?
I'm clearly missing something.