use_key_in_widget_constructors

Group: errors

Maturity: stable

Linter v0.1.108

Since info is static, may be stale
flutter

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({Key? key}) : super(key: key);
}