Skip to main content

arguments-ordering

added in: 1.6.0
⚙️🛠

Enforces named argument order in function and constructor invocations to be the same as corresponding named parameter declaration order.

⚙️ Config

info

child-last config option was removed in 1.16.0. To have a similar behavior, pass child and children to last.

Set last (default is empty) to configure a list of arguments that should be the last.

dart_code_metrics:
...
rules:
...
- arguments-ordering:
last:
- child
- children

Example

❌ Bad:

Person buildPerson({ String name, String surname, String age });

// LINT
final person = buildPerson(age: 42, surname: 'The Pooh', name: 'Winnie');

✅ Good:

Person buildPerson({ String name, String surname, String age });

final person = buildPerson(name: 'Winnie', surname: 'The Pooh', age: 42);