Keys in flutter

Key are the IDs for widgets. Basically, they are used to access the state of stateful widgets.

Note: There is no need for keys in stateless widgets.

Q#: Where to use Keys?

Ans: When we want to reuse some widgets and when we want to do some changes in widgets then we use keys.

There are four types of key

1. ValueKey

2. ObjectKey

3. UniqueKey

4. GlobalKey


Previous Post Next Post