Skip to main content

map-keys-ordering

added in: 1.7.0
🛠
Pro+

Ensures consistent alphabetical order of String keys inside a map.

Example

❌ Bad:

final map = {
'value': 'world',
'some': 1, // LINT: Map keys do not match the alphabetical order. Try sorting them.
'hello': true, // LINT: Map keys do not match the alphabetical order. Try sorting them.
};

✅ Good:

final map = {
'hello': true,
'some': 1,
'value': 'world',
};