selectedIndex property

int get selectedIndex

Gets or sets the first selected item in the list.

Implementation

int get selectedIndex {
  if (_helper.isLoadedField && _helper.selectedIndex == -1) {
    _helper.selectedIndex = _obtainSelectedIndex();
  }
  if (_helper.selectedIndex == -1) {
    ArgumentError.value('None of the item to be selected in the list');
  }
  return _helper.selectedIndex;
}
set selectedIndex (int value)

Implementation

set selectedIndex(int value) {
  RangeError.range(value, 0, items.count, 'SelectedIndex');
  if (selectedIndex != value) {
    if (_helper.isLoadedField) {
      _assignSelectedIndex(value);
      _helper.changed = true;
    }
    _helper.selectedIndex = value;
    final PdfRadioButtonListItem item = _items![_helper.selectedIndex];
    final PdfDictionary dictionary = _helper.dictionary!;
    dictionary.setName(PdfName(PdfDictionaryProperties.v), item.value);
    dictionary.setName(PdfName(PdfDictionaryProperties.dv), item.value);
  }
}