Flutter Dart-带有工厂及其子级的抽象类

Flutter Dart-带有工厂及其子级的抽象类,flutter,dart,Flutter,Dart,我的颤振应用程序中有两个类: class ChildrenA{ .... factory ChildrenA.fromJson(Map<String, dynamic> json) => ChildrenA( x: json["x"], y: json["y"], ); } class ChildrenB{ .... factory C

我的颤振应用程序中有两个类:

 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"],
     );
 }
class-ChildrenA{
....
工厂ChildrenA.fromJson(映射json)=>ChildrenA(
x:json[“x”],
y:json[“y”],
);
}
B类儿童{
....
工厂ChildrenA.fromJson(映射json)=>ChildrenB(
x1:json[“x1”],
y2:json[“y2”],
);
}
我可以为这两个类添加父类吗?差不多是这样

   abstract class Parent{
     factory Parent.fromJson(Map<String,dynamic> json);
   }
抽象类父类{
factory Parent.fromJson(映射json);
}

在dart中可能吗?或者其他方法-使用mixin?

构造函数不会被继承,所以可能不会