count property Null safety

int count

Gets number of the elements in the collection. Read-Only.

//Load the PDF document.
PdfDocument document = PdfDocument(inputBytes: inputBytes);
//get the bookmark count.
int count = document.bookmarks.count;
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

int get count {
  final PdfDocument? document = _helper._crossTable.document;
  if (document != null) {
    if (_booklist == null) {
      _booklist = <PdfBookmarkBase>[];
      for (int n = 0; n < _list.length; n++) {
        _booklist!.add(_list[n]);
      }
    }
    return _list.length;
  } else {
    return _list.length;
  }
}