prefer-center-over-align
Suggests using a Center
widget instead of the Align
widget with no passed arguments.
Example
❌ Bad:
class SomeWidget {
Widget build() {
// LINT: Prefer 'Center' over the 'Align' widget with 'Alignment.center'.
return Align();
}
}
✅ Good:
class SomeWidget {
Widget build() {
return Align(alignment: Alignment.left);
}
}
class SomeWidget {
Widget build() {
return Center();
}
}