move-variable-outside-iteration
Warns when a variable does not depend on the outer loop and can be moved out.
❌ Bad:
void fn() {
final list = [1, 2, 3];
for (final element in list) {
final reversed = list.reversed; // LINT
...
}
}
✅ Good:
void fn() {
final list = [1, 2, 3];
final reversed = list.reversed;
for (final element in list) {
...
}
}