Limit the amount of prefix tabs/spaces in lines of code, by limiting nesting. Flutter widget code can sometimes become nested to a level where lines of code become prefixed by a considerable amount of tabs/spaces.
combined with a linter such as lines_longer_than_80_chars, even short code lines would have to be broken up to multiple lines - so they won't exceed the 80 character limit.
Details
Below is an example of deeply nested code from the Flutter Constraints documentation. What might otherwise be code that is easy to read and occupy one line of code
[x ] List any existing rules this proposal modifies, complements, overlaps or conflicts with.
[x ] List any relevant issues (reported here, the SDK Tracker, or elsewhere).
[x ] If there's any prior art (e.g., in other linters), please add references here.
[x ] If this proposal corresponds to Effective Dart or Flutter Style Guide advice, please call it out. (If there isn't any corresponding advice, should there be?)
[x ] If this proposal is motivated by real-world examples, please provide as many details as you can. Demonstrating potential impact is especially valuable.
nesting_too_deep
Description
Limit the amount of prefix tabs/spaces in lines of code, by limiting nesting. Flutter widget code can sometimes become nested to a level where lines of code become prefixed by a considerable amount of tabs/spaces. combined with a linter such as lines_longer_than_80_chars, even short code lines would have to be broken up to multiple lines - so they won't exceed the 80 character limit.
Details
Below is an example of deeply nested code from the Flutter Constraints documentation. What might otherwise be code that is easy to read and occupy one line of code
Has to be broken down to 3 lines, making the code less readable. The same code can be refactored with helper functions, to reduce nesting.
Kind
Style advice
Bad Examples
See description for a code that could trigger the linter
Good Examples
Discussion
Discussion checklist