restoreContext method Null safety

void restoreContext()

This releases any resources used by this Graphics object. You must use this method once finished with it.

When using PdfPage, you can create another fresh Graphics instance, which will draw over this one.

Implementation

void restoreContext() {
  if (_contextQueue.isNotEmpty) {
    // restore graphics context
    _buf.putString('Q\n');
    _context = _contextQueue.removeLast();
  }
}