Skip to main content

initializers-ordering

effort: 2m
has IDE fix
has auto-fix
pro+

Ensures that the order of constructor initializers matches the order of the class fields.

Example

❌ Bad:

class Some {
final String value;
final int another;

// LINT: Constructor initializers do not match the fields order. Try sorting them.
const Some() : another = 1, value = 'some';
}

✅ Good:

class Some {
final String value;
final int another;

const Some() : value = 'some', another = 1;
}