use_key_in_widget_constructors

Group: errors

Maturity: stable

Dart SDK: >= 2.8.1 • (Linter v0.1.108)

Since info is static, may be stale
flutterhas-fix

View all Lint Rules

Using the Linter

DO use key in widget constructors.

It's a good practice to expose the ability to provide a key when creating public widgets.

BAD:

class MyPublicWidget extends StatelessWidget {
}

GOOD:

class MyPublicWidget extends StatelessWidget {
  MyPublicWidget({super.key});
}