findIndexByKey method

int? findIndexByKey(
  1. Key key
)

Find index of child element with associated key.

This will be called during performRebuild in SliverMultiBoxAdaptorElement to check if a child has moved to a different position. It should return the index of the child element with associated key, null if not found.

If not provided, a child widget may not map to its existing RenderObject when the order of children returned from the children builder changes. This may result in state-loss.

Implementation

int? findIndexByKey(Key key) => null;