Saltar al contenido principal

avoid-redundant-async-on-load

added in: 1.0.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.

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() {
...
}
}