indexOf method

int indexOf(
  1. PdfListItem item
)

Determines the index of a specific item in the list.

//Create a new PDF document.
PdfDocument document = PdfDocument();
//Create a list item.
PdfListItem item = PdfListItem(text: 'PDF');
//Create a new ordered list.
PdfOrderedList oList = PdfOrderedList(
    items: PdfListItemCollection()
      ..add(item)
      ..add(PdfListItem(text: 'DocIO')),
    font: PdfStandardFont(PdfFontFamily.helvetica, 16,
        style: PdfFontStyle.italic));
//Get the index of specific item.
int index = oList.items.indexOf(item);
//Draw the list to the page.
oList.draw(
    page: document.pages.add(), bounds: const Rect.fromLTWH(20, 20, 0, 0));
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

int indexOf(PdfListItem item) {
  return _helper.indexOf(item);
}