When I auto generate dart constructors, I would like the generator to make my constructors using named parameters and add key.
(Curly braces wrapping the constructor arguments)
Is there some easy trick I can perform to make Android Studio do this for me?
// Auto generated constructor without named parameters.
// This is how Android studio currently generates my Widget constructors.
class MyTestModel {
MyTestModel(this.a, this.b, this.c);
final String a;
final String b;
final String c;
}
// Constructor with named parameters and key.
// This is how I would like Android Studio Auto Generate to behave.
class MyTestModelB {
MyTestModelB({Key key, this.a, this.b, this.c}) : super(key: key);
final String a;
final String b;
final String c;
}
So another way to phrase my question:
When I press "Command + N" and I use Android Studio to automatically generate my Dart constructor.
Currently Android Studio does not generate Named Parameter Constructors for me, neither does it add a key to the constructors.
Somewhere I guess there is a Template of some kind that Android Studio uses to autogenerate those constructors. I guess I need to access that Template and modify it to have it autogenerate Named Parameter Constructors for me, and add key. But where is it?
My installation of Flutter/Dart/Android studio is rather new. From April/May 2020.