ReorderCallback typedef
A callback used by ReorderableList to report that a list item has moved to a new position in the list.
Implementations should remove the corresponding list item at oldIndex
and reinsert it at newIndex.
link
final List<MyDataObject> backingList = <MyDataObject>[/* ... */];
void handleReorderItem(int oldIndex, int newIndex) {
final MyDataObject element = backingList.removeAt(oldIndex);
backingList.insert(newIndex, element);
}
See also:
- ReorderableList, a widget list that allows the user to reorder its items.
- SliverReorderableList, a sliver list that allows the user to reorder its items.
- ReorderableListView, a Material Design list that allows the user to reorder its items.
Implementation
typedef ReorderCallback = void Function(int oldIndex, int newIndex);