pages property Null safety

PdfPageCollection pages

Gets the collection of pages in the document.

//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

PdfPageCollection get pages => _getPageCollection();