selectedItem property
Index of the item that will be placed next.
Implementation
late int selectedItem = widget.initialItem.clamp(0, max(0, widget.items.length - 1));
Index of the item that will be placed next.
late int selectedItem = widget.initialItem.clamp(0, max(0, widget.items.length - 1));