keyWithData method

Widget keyWithData()

Returns a new widget whose key is based on this widget's text data

Useful when combined with AnimatedSwitcher to allow for automatic transitions when the text changes.

Implementation

Widget keyWithData() => KeyedSubtree(
      key: ValueKey(data),
      child: this,
    );