Reputation: 5944
I have two class in my flutter app:
class ChildrenA{
....
factory ChildrenA.fromJson(Map<String, dynamic> json) => ChildrenA(
x: json["x"],
y: json["y"],
);
}
class ChildrenB{
....
factory ChildrenA.fromJson(Map<String, dynamic> json) => ChildrenB(
x1: json["x1"],
y2: json["y2"],
);
}
Can I add a parent class for these two? more or less like this
abstract class Parent{
factory Parent.fromJson(Map<String,dynamic> json);
}
is it possible in dart? or other ways - using mixin?
Upvotes: 1
Views: 222