dart-data-plugin
dart-data-plugin copied to clipboard
Auto generate widget constructors
It is a long time I touched this plugin, but here is a random idea.
Flutter widget constructor generator
It would be cool to have an automatic key generated for Widget classes, so the parameter does not have to be added each time.
class TestWidget extends StatelessWidget {
final String name;
final int age;
// generated constructor here
const TestWidget({Key key, this.name, this.age}) : super(key: key);
}
Smart regeneration
Furthermore, it would also be cool if the constructor generator would take the existing parameters into account in case of a simple super call. So if there is already parameters passed through to the default constructor, they would be left untouched and only the other fields would be regenerated.
class TestWidget extends MyInternalWidget {
final String name;
final int age;
// generated constructor here, 'service' is untouched when regenerated
const TestWidget({Key key, MyService service, this.name, this.age}) : super(key: key, service: service);
}