selectedValue property

String selectedValue

Gets or sets the value of the first selected item in the list.

Implementation

String get selectedValue {
  if (_helper.isLoadedField) {
    if (selectedIndex == -1) {
      _helper.selectedIndex = _obtainSelectedIndex();
    }
    if (_helper.selectedIndex != -1) {
      return _items![_helper.selectedIndex].value;
    } else {
      ArgumentError('None of the item to be selected in the list');
    }
    return _items![_helper.selectedIndex].value;
  } else {
    if (_helper.selectedIndex == -1) {
      ArgumentError('None of the item to be selected in the list');
    }
    return _items![_helper.selectedIndex].value;
  }
}
void selectedValue=(String value)

Implementation

set selectedValue(String value) {
  if (_helper.isLoadedField) {
    _assignSelectedValue(value);
    _helper.changed = true;
  } else {
    final List<Object> objects =
        PdfObjectCollectionHelper.getHelper(items).list;
    for (final Object? item in objects) {
      if (item is PdfRadioButtonListItem && item.value == value) {
        _helper.selectedIndex = items.indexOf(item);
        final PdfDictionary dictionary = _helper.dictionary!;
        dictionary.setName(PdfName(PdfDictionaryProperties.v), item.value);
        dictionary.setName(PdfName(PdfDictionaryProperties.dv), item.value);
        break;
      }
    }
  }
}