measure method Null safety

PdfPoint measure(
  1. Widget widget,
  2. {PdfPage? page,
  3. PdfGraphics? canvas,
  4. BoxConstraints? constraints,
  5. Context? context}
)

Measure the size of a widget to a page canvas.

Implementation

static PdfPoint measure(
  Widget widget, {
  PdfPage? page,
  PdfGraphics? canvas,
  BoxConstraints? constraints,
  Context? context,
}) {
  context ??= Context(
    document: page!.pdfDocument,
    page: page,
    canvas: canvas!,
  ).inheritFromAll(<Inherited>[
    ThemeData.base(),
  ]);

  widget.layout(
    context,
    constraints ?? const BoxConstraints(),
  );

  assert(widget.box != null);
  return widget.box!.size;
}