Skip to content

Files

Latest commit

 

History

History
26 lines (17 loc) · 540 Bytes

use_key_in_widget_constructors.md

File metadata and controls

26 lines (17 loc) · 540 Bytes

Pattern: Missing use of key in widget constructor

Issue: -

Description

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

Example of incorrect code:

class MyPublicWidget extends StatelessWidget {
}

Example of correct code:

class MyPublicWidget extends StatelessWidget {
 MyPublicWidget({Key key}) : super(key: key);
}

Further Reading