AAListSection constructor
AAListSection({
- String? title,
- required List<
AAListItem> items, - int? selectedIndex,
- dynamic onSelected(
- int selectedIndex,
- AAListItem selectedItem
- String? id,
Implementation
AAListSection({
this.title,
required this.items,
this.selectedIndex,
this.onSelected,
String? id,
}) : assert(
selectedIndex == null ||
(selectedIndex >= 0 && selectedIndex < items.length),
'selectedIndex must be within the list item range.',
),
assert(
(selectedIndex == null && onSelected == null) || items.isNotEmpty,
'A selectable list must have at least one item.',
),
assert(
selectedIndex == null && onSelected == null ||
items.every((AAListItem item) => item.onPress == null),
'Selectable list items must not have an onClickListener set.',
),
assert(
selectedIndex == null && onSelected == null ||
items.every((AAListItem item) => item.toggle == null),
'Selectable list items must not have a toggle set.',
),
_elementId = id ?? const Uuid().v4();