id method

Widget id(
  1. Object valueKey
)

Assigns a ValueKey to this widget using the provided value.

This is a convenience method for creating and assigning a ValueKey. Value keys are useful for identifying widgets based on their data values.

Example:

Container().id('unique-id'),
ListTile(title: Text(item.name)).id(item.id),

Implementation

Widget id(Object valueKey) {
  return _WidgetWrapper._wrapOrCopyWith(
    child: this,
    key: () => ValueKey(valueKey),
  );
}