Closed FMorschel closed 1 year ago
Available in 5.0.0 🚀 with this order https://github.com/dart-code-checker/dart-code-metrics/blob/master/lib/src/analyzers/lint_analyzer/rules/rules_list/member_ordering/config_parser.dart#L16 as default for widgets
Please describe what the rule should do: Inspired by #454, I do believe that a new rule would be better, making it so that you could use a different ordering inside "Flutter classes". I'm not sure if the analyzer could identify if we extended an existing
StatefulWidget
child created by us, but at least it could warn whenextends
/implements
. And this could have the defaults mentioned by zs-dima at #454. Here for easier reading: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#order-other-class-members-in-a-way-that-makes-senseThis is also something my team usually does, for example: Inside a State, we initialize static members, instance members, default overrides (
initState
,didChangeDependencies
,dispose
,build
, etc) and all methods are usually private inside a state so they come after. And then, all the other classes follow the same ordering, but it's a little different, for example, all public methods stay at the end.If your rule is inspired by other please provide link to it: https://dartcodemetrics.dev/docs/rules/common/member-ordering-extended https://dartcodemetrics.dev/docs/rules/common/member-ordering
What category of rule is this? (place an "X" next to just one item)
[ ] Warns about a potential error (problem) [ ] Suggests an alternate way of doing something (suggestion) [X] Other (please specify:) Style
Provide 2-3 code examples that this rule will warn about (it will be better if you can provide both good and bad examples):
IGNORED
GOOD
BAD
Are you willing to submit a pull request to implement this rule? I don't have the knowledge.