tryFromList static method
Lenient version of PdfBox.fromList: returns null instead of throwing.
Implementation
static PdfBox? tryFromList(List<num>? values) {
if (values == null || values.length != 4) return null;
for (final value in values) {
final asDouble = value.toDouble();
if (asDouble.isNaN || asDouble.isInfinite) return null;
}
return PdfBox(
values[0].toDouble(),
values[1].toDouble(),
values[2].toDouble(),
values[3].toDouble(),
);
}