dispose method

void dispose()

Releases all the resources used by document instances.

//Create a PDF document instance.
PdfDocument document = PdfDocument();
//Get the page and draw text.
document.pages.add().graphics.drawString(
    'Hello World!', PdfStandardFont(PdfFontFamily.helvetica, 12),
    brush: PdfBrushes.black, bounds: Rect.fromLTWH(0, 0, 0, 0));
//Save and dispose document.
List<int> bytes = await document.save();
document.dispose();

Implementation

void dispose() {
  PdfBrushesHelper.dispose();
  PdfPensHelper.dispose();
  _helper.crossTable.dispose();
  _helper._security = null;
  _helper.currentSavingObject = null;
}