What about writing this as:
```dart
config.keys.toList()
    ..sort((n1, n2) => ...)
    .forEach((name) {...})
```