AAListSection constructor

AAListSection({
  1. String? title,
  2. required List<AAListItem> items,
  3. int? selectedIndex,
  4. dynamic onSelected(
    1. int selectedIndex,
    2. AAListItem selectedItem
    )?,
  5. 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();