Keys in Flutter are used as an identifier for Widgets, Elements and SemanticsNodes. We can use it when a new widget tries to update an existing element; then, its key should be the same as the current widget key associated with the element.
Keys should not be different amongst the Elements within the same parent.
The subclasses of Key must be a GlobalKey or LocalKey.
Keys are useful when we try to manipulate (such as adding, removing, or reordering) a collection of widgets of the same type that hold some state.