operator [] method Null safety

PdfBookmark operator [](
  1. int index
)

Gets the bookmark at specified index.

//Load the PDF document.
PdfDocument document = PdfDocument(inputBytes: inputBytes);
//Get the bookmark from index.
PdfBookmark bookmarks = document.bookmarks[0]
  ..destination = PdfDestination(document.pages[1])
  ..color = PdfColor(0, 255, 0)
  ..textStyle = [PdfTextStyle.bold]
  ..title = 'Changed title';
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

PdfBookmark operator [](int index) {
  if (index < 0 || index >= count) {
    throw RangeError('index');
  }
  return _list[index] as PdfBookmark;
}