add method Null safety

PdfLayer add(
  1. {String? name,
  2. bool? visible}
)

Creates a new PdfLayer with name and adds it to the end of the collection.

Implementation

PdfLayer add({String? name, bool? visible}) {
  final PdfLayer layer = PdfLayer._();
  if (name != null) {
    layer.name = name;
  }
  layer._document = _document;
  if (visible != null) {
    layer.visible = visible;
  }
  layer._layerId = 'OCG_' + _PdfResources._globallyUniqueIdentifier;
  layer._layer = layer;
  _add(layer);
  return layer;
}