destination property Null safety

PdfDestination? destination

Gets or sets the outline destination page.

//Create a new document.
PdfDocument document = PdfDocument();
//Create document bookmarks.
PdfBookmark bookmark = document.bookmarks.add('Page 1')
  //Set the destination page.
  ..destination = PdfDestination(document.pages.add(), Offset(20, 20))
  ..textStyle = [PdfTextStyle.bold]
  ..color = PdfColor(255, 0, 0);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

PdfDestination? get destination {
  if (_isLoadedBookmark) {
    PdfDestination? destination;
    if (_obtainNamedDestination() == null) {
      destination = _obtainDestination();
    }
    return destination;
  } else {
    return _destination;
  }
}
void destination=(PdfDestination? value)

Implementation

set destination(PdfDestination? value) {
  if (value != null) {
    _destination = value;
    _helper.dictionary!.setProperty(PdfDictionaryProperties.dest, value);
  }
}