Skip to main content

avoid-redundant-async-on-load

added in: 5.6.0
warning
🛠

Warns when a Component's onLoad method can be made sync.

Refactoring async onLoad to sync helps Flame directly continue in it's loading cycle.

info

The fix for this rule is available only in "Teams" version.

Example

❌ Bad:

class MyComponent extends Component {
Future<void> onLoad() async {
... // LINT, has no await
}
}

✅ Good:

class MyComponent extends Component {
Future<void> onLoad() async {
await ...
}
}

class MyComponent extends Component {
void onLoad() {
...
}
}