flutter-intellij
flutter-intellij copied to clipboard
Feature request: Option to convert all constructor parameters to required named parameters
If I have a widget like the following,
class MyWidget extends StatelessWidget {
final arg1, arg2, arg3; // I know this is cringy, it's just for the sake of example.
MyWidget(this.arg1, this.arg2, this.arg3); // same with this.
}
or
class MyWidget extends StatelessWidget {
final arg1, arg2, arg3; // I know this is cringy, it's just for the sake of example.
MyWidget({this.arg1, this.arg2, this.arg3}); // same with this.
}
can you provide an option to convert the parameters to required named parameters in one fell swoop?
class MyWidget extends StatelessWidget {
final arg1, arg2, arg3; // I know this is cringy, it's just for the sake of example.
MyWidget({@required this.arg1, @required this.arg2, @required this.arg3}); // same with this.
}
This would be a fantastic refactor. I've manually performed this refactor dozens of times.
Yup. It would be nice to have the choice when creating them from the intellisense when declaring final variables and from the generate constructor option as well, although that would be secondary.
@pq @scheglov, fyi for possible future text editing refactorings
Hi, any update on this? I think many, as myself, expect to use this feature. Thank you.
This should at least work when adding a not-yet-present final field to a constructor via the quick fix
Any updates on this?