graphics property Null safety

PdfGraphics graphics

Gets the graphics of the defaultLayer.

//Create a new PDF documentation
PdfDocument document = PdfDocument();
//Create a new PDF page and draw the text
document.pages.add().graphics.drawString(
    'Hello World!!!',
    PdfStandardFont(PdfFontFamily.helvetica, 27),
    brush: PdfBrushes.darkBlue,
    bounds: const Rect.fromLTWH(170, 100, 0, 0));
//Save the document.
List<int> bytes = document.save();
//Dispose the document.
document.dispose();

Implementation

PdfGraphics get graphics {
  _isDefaultGraphics = true;
  return defaultLayer.graphics;
}