Skip to main content

record-fields-ordering

added in: 1.25.0
🛠
Dart 3.0+
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});