data_classes icon indicating copy to clipboard operation
data_classes copied to clipboard

Optional named constructor parameters

Open vendik opened this issue 5 years ago • 0 comments

Would it be possible to add support for optional named constructor parameters by specifying a default value in the base Mutable class?

For example this class:

@GenerateDataClass()
class MutableState {
    String a = "";
    String b;
}

Would generate the this constructor:

const ProfileConfirmState({
    this.a = "",
    @required this.b
  }) : assert(a != null),
       assert(b != null);

vendik avatar Feb 28 '20 14:02 vendik