Skip to main content

record-fields-ordering

dart 3.0+
has auto-fix
pro+

Ensured consistent alphabetical order of named record fields.

Example

❌ Bad:

// LINT: Record field names do not match the alphabetical order. Try sorting them.
typedef Record = (String hello, {int b, int a});

// LINT: Record field names do not match the alphabetical order. Try sorting them.
(String hello, {int b, int a}) fn() => ('hi', b: 1, a: 2);

✅ Good:

typedef Record = (String hello, {int a, int b});