key property

Object? key
final

The key is used to identify components of the same type.

Instances of components of the same type are considered identical. This is fair and works correctly as long as the components have no input parameters. When using components with parameters, this makes the components dependent on the arguments passed as parameters.

To be able to distinguish components of the same type from each other, this key is used to distinguish instances of the component.

It is recommended to use, as a value, an appropriate key instance with all the important arguments.

Example:

Widget1(this.arg1, this.arg2) : super(key: Key([arg1, arg2]));

Implementation

final Object? key;