spkersten / dart_functional_data

Simple and non-intrusive code generator for lenses and boilerplate of data types
https://pub.dev/packages/functional_data
MIT License
41 stars 15 forks source link

Class can't be used as mixin because it declares constructor... #5

Closed ValeriusGC closed 5 years ago

ValeriusGC commented 5 years ago

in your sample:

@FunctionalData()
class Foo with $Foo {
  final int number;
  final String name;

  // Can't be const because of mixin
  Foo({this.number, this.name});
}

in real life i got error Class can't be used as mixin because it declares constructor...

@immutable
@FunctionalData()
class Base with $Base{
  final int uid;
  final int editTime;

  Base({this.uid, this.editTime});
}
ValeriusGC commented 5 years ago

So, how one can use this with inheritance?

spkersten commented 5 years ago

Looks like a mistake in the documentation (or a left-over from an earlier incarnation). Instead: class Base extends $Base should work.

spkersten commented 5 years ago

I've fixed the documentation.

ValeriusGC commented 5 years ago

So, is it planning to use this with inheritance?

jaggerwang commented 4 years ago

@spkersten Can the generated class to be a mixin? As dart not support multiple inheritance.