Skip to content

Conversation

@ktanaka101
Copy link

Description

What & Why

Both the public docs and the native Android / iOS layers say
PdfPage.render() defaults to PNG when format is omitted.
The Dart signature, however, still defaulted to PdfPageImageFormat.jpeg.

// produces PNG bytes even though the API claims JPEG
final img = await page.render(format: PdfPageImageFormat.jpeg);

That mismatch triggers a false-positive from the
avoid_redundant_argument_values
linter: it tells you to drop the argument, but doing so would silently
change the result from JPEG → PNG.

This PR aligns the Dart default with reality:

- PdfPageImageFormat format = PdfPageImageFormat.jpeg,
+ PdfPageImageFormat format = PdfPageImageFormat.png,

Tests

Added test/pdfx_test.dart.

State Result Meaning
Pre-patch ✅ Pass Reveals that PNG was already returned at runtime.
Post-patch ✅ Pass API, docs and native behaviour are now consistent.

Impact

  • No breaking change – callers already received PNG bytes by default.
  • Eliminates the misleading linter warning, improving DX.

Thanks for reviewing!

The public docs—and the native Android / iOS layers—treat PNG as the
default output format when `format` is omitted, but the Dart signature
still defaulted to `PdfPageImageFormat.jpeg`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant