ATL-2026-024engineering_noteexperimental

One feature, several megabytes. What actually takes up space in a Flutter app?

One PDF button, three different jobs: file handoff, a platform renderer and a bundled engine. Measured Android build sizes and the work an app must provide itself.

Published
October 23, 2026
Verified
October 22, 2026

One feature, several megabytes. What actually takes up space in a Flutter app?

A document appears in the order history. The app needs a button to read it. The file already exists, the server needs no changes, and there is a suitable Flutter PDF package. On screen, that is one new feature. In the build, it is another set of dependencies, sometimes including an entire document-processing engine.

The first reaction to the increase is predictable: all that for one PDF? Someone suggests opening the file in another app. That can reduce what the app ships. But first, it is worth asking what has been replaced: the viewing implementation, or the product requirement itself.

A customer needs a receipt copy. A field engineer needs a manual alongside a work report. Someone reading a contract needs to find a clause and copy payment details. All three interfaces might use the same button. The work behind it is different.

That is why comparing PDF viewers by size only makes sense after answering a different question: what must the application provide on its own?

Three ways to show one document

The shortest route is to hand the file to another application. open_filex 5.0.0 is one example: the app prepares a local copy and asks the system to find a PDF handler.

final result = await OpenFilex.open(
  localPath,
  type: 'application/pdf',
);

Here, localPath points to an already prepared file. This call does not handle downloading it, deciding how long to retain it, or making it available offline. Nor does it ensure that a PDF-capable application is installed. The result needs handling; a successful handoff does not mean that the person has seen the document, let alone read it.

The second route keeps the viewer inside the Flutter app but uses platform capabilities. pdfx 2.11.0 provides a controller and a page-viewing widget. In the Android implementation inspected for this experiment, the package uses the system's android.graphics.pdf.PdfRenderer.

controller = PdfControllerPinch(
  document: PdfDocument.openFile(localPath),
);

// In the widget tree:
PdfViewPinch(controller: controller);

The controller lives as long as the screen and is released through dispose(). The complete implementation in the experiment accounts for that lifecycle. The more important point is that the app gets its own screen without shipping a separate PDF engine just for Android. The renderer has not disappeared: it is already part of the system.

The third route ships an engine with the app. pdfrx 2.4.8 uses PDFium; on Android, its native library is included in the build. Yet adding it to a screen looks shorter than the previous example:

PdfViewer.file(localPath)

Line count is misleading. One widget can hide more code and capabilities than several classes in a custom interface. pdfrx documents text selection, search and document outline support. Those capabilities do not make every PDF comfortable to read. They do explain why treating it and a simple file handoff as interchangeable implementations would be an odd comparison.

What was measured

The local ArkTelos Lab experiment uses one Android app shell with a button to open a document. Every variant retains the same bundled PDF, copying to a local file, theme and shared application code. File preparation uses path_provider 2.1.6, so this dependency is present even in the baseline without a viewer.

The source and feature variants are available in the public ArkTelos Lab repository at a pinned commit. It also contains reproduction commands, lockfiles and the measured results.

External opening, pdfx and pdfrx were then built separately. In each variant, the opening code is wired to the button and included in the release build: the package is not merely listed in pubspec.yaml.

The environment is fixed: Flutter 3.44.7, Dart 3.12.2, Android arm64 release. The pdfrx version is specifically 2.4.8. As of the check on 22 October 2026, the current 2.9.0 requires a newer SDK and was not part of the experiment. These numbers cannot be attributed to it.

The build command is the same for every variant:

flutter build apk --release \
  --target-platform android-arm64 \
  --analyze-size

Using one architecture avoids mixing the cost of a feature with several copies of native libraries for different processors. However, the Flutter flag alone proved insufficient in the preliminary build: a shared dependency using JNI to communicate with native code left helper libraries for two additional architectures. The Android configuration therefore also restricts ndk.abiFilters to arm64-v8a, and the actual archive contents are checked. The preliminary APK is excluded from the final comparison.

Release mode keeps debugging tools out of the measurement. --analyze-size helps inspect the build; the APK entries were also examined directly, including the Dart library, other native libraries, Android code and resources.

The resulting sizes are below. One MiB is 1,048,576 bytes; each increase is measured against the shared shell without a viewer.

Variant APK, bytes APK, MiB Increase, MiB
File prepared, no viewer 15,425,210 14.711 —
External opening, open_filex 5.0.0 15,691,533 14.965 +0.254
In-app viewing, pdfx 2.11.0 15,572,594 14.851 +0.141
In-app viewing, pdfrx 2.4.8 22,867,928 21.809 +7.098

The first interesting result: the in-app pdfx variant is slightly smaller than external opening. The Android dependencies of open_filex 5.0.0 include the AppCompat compatibility library, and Android code and resources grew in the resulting APK. For pdfx, most of the increase is in the compiled Dart library. The external application is not shipped in the APK, but the mechanism used to reach it still has a cost.

The second result is harder to miss. pdfrx adds libpdfium.so at 6,386,696 bytes, about 6.091 MiB. In this build, it is stored in the APK without ZIP compression. libapp.so, the library containing compiled Dart code for the whole application, not just one package, also grows by 1 MiB. These two differences account for almost the entire 7.098 MiB increase. Meanwhile, libflutter.so has the same size in all four variants: 11,581,856 bytes.

This does not mean PDFium is “wasting” six megabytes. The build now contains a PDF-processing implementation that the handoff variant does not include and that pdfx gets from Android. The next question is whether the product needs the capabilities and characteristics of this particular implementation.

The numbers describe a feature in this specific setup. The APK delta includes dependencies, resources, compression and alignment. It is not a universal package-size specification. No WASM assets were found in these Android archives.

This is the size of a particular APK, not a promise about how many megabytes a user will download. A store can produce different deliveries from an Android App Bundle, split by device. File size, download size and installed size are different quantities. The Flutter documentation explicitly draws that distinction.

These builds were not run on devices. The experiment checks build contents and size, not opening speed, memory use, rendering quality, accessibility or resilience to damaged documents. One test PDF keeps build conditions consistent; it is not a format-compatibility test corpus.

A smaller build may mean someone else does the work

External opening has a perfectly reasonable use case. An app keeps an order history, and a customer occasionally retrieves a receipt or sends a document to an accountant. If the job really is to obtain a copy, a document editor inside the shop app may be unnecessary. The app needs to prepare the file correctly, hand it over and explain what to do when no handler is available.

But a smaller APK does not make reading free. The receiving application takes up space separately. It may already be installed; the user may have to find one. This experiment does not measure the combined footprint of every application on the phone.

The file also leaves the app's boundary. On Android, this handoff uses a content URI and temporary access permissions: a documented file-sharing mechanism. It handles access, but does not decide whether the product may pass a particular document to another application. It would be wrong to assume that every external viewer uploads files to the cloud. It would be equally wrong to promise that the originating app controls an arbitrary receiver's behaviour.

Now consider a different situation: a field worker reads a manual while filling in a work report. After each viewing, they must return to the same task, keep the completed fields and continue offline. An external transition may be acceptable, but the whole journey needs checking. If a managed device has no PDF application at all, “open with” does not complete the job.

An in-app screen can be useful here even without advanced PDF features. A screen, though, not necessarily the most capable engine available. If paging and zooming are enough, an implementation over the system renderer is worth testing first. Whether to ship PDFium is a further question, not an inevitable consequence of “in-app”.

Showing a page is not the same as making it readable

The opposite mistake is to treat a smaller viewer as a complete replacement for a larger one because both display the first page.

Someone reading a lengthy contract needs to find a particular clause. In an invoice, they copy an account number and an amount. At a larger zoom level, they need to follow the line. A screen-reader user expects access to the content, not merely an image rectangle.

Rendering a page as an image does not provide these capabilities by itself. Text selection, search and correct accessibility semantics are different features; the first does not prove the others. A document with a text layer and a scan without recognised text present different conditions, too. Adding a PDF package does not automatically fix the source document.

Before a replacement, it is therefore useful to define a few user actions rather than write “both support PDF”: open the right page, find a word, copy a passage, return to work, read through an accessible interface. Then test those actions on the product's own documents and supported devices. That testing is absent from this experiment, so there is no basis for claiming functional equivalence.

When the engine ships with the app, the team chooses its version and is responsible for updating it. That does not guarantee identical behaviour for every document on every platform. Using the system renderer does not remove responsibility either, but a different part of the implementation is updated with the platform.

Why removing a dependency may save less than expected

The number of packages in pubspec.lock is a poor measure of application size. Some dependencies are used only during the build. The compiler removes unreachable Dart code. Some assets ship in the final application; others belong to a different platform. A native library may ship as a separate file rather than be reduced to individual lines of Dart.

So “how big is the package?” is too imprecise. What matters is how much the used feature adds to a particular build. If the application already includes the necessary engine for another feature, a second screen need not pay for its size again. If a large native library is needed only by this viewer, removing the viewer may save more than trimming custom Dart code.

For the same reason, putting PDF opening on a rarely visited screen does not, by itself, reduce the installation. If the library remains in the APK, the user receives it without ever opening that screen. Delayed invocation is not delayed delivery. Separate downloading needs its own design and testing, including offline behaviour; it is not part of this experiment.

The practical outcome is not an instruction to remove the largest package. A receipt history may need nothing more than file handoff. A working document may benefit from in-app viewing through the system renderer. Search, selection and further processing require a different set of tools, with their own cost. The choice follows the job, not the mood after looking at the size report.

A new feature needs more than an entry in a feature list. It needs an explanation of what the application takes responsibility for. With that in place, the extra megabytes can be judged. Without it, one team defends a small build and another defends user convenience, while they are discussing different products under the same name: “PDF viewer”.


ArkTelos Lab: engineering journal · official ArkTelos website

Channels: ArkTelos Lab EN · ArkTelos Lab RU · ArkTelos EN · ArkTelos RU

Result boundaries

  • Physical APK size and ZIP contents were measured, not viewer functional equivalence. The figures describe this setup, not a universal package weight.

CODE / DATA / AGENTS

Related experiments

experimentpdf-viewer-feature-cost

Compare the incremental size of three PDF implementations in one Android release shell and inspect the source of the differences.

One final APK per variant, not repeated measurements. No device or emulator execution. Speed, RAM, accessibility, rendering quality, PDF compatibility, iOS, store download and installed size were not tested. pdfrx 2.9.0 was excluded. Template debug signing; cross-machine binary hashes are not guaranteed.

Open the experiment record →

Telegram edition

Read in ArkTelos Lab

Read in ArkTelos Lab ↗

ARKTELOS CHANNELS

News and engineering material, without mixing languages.

The main channels cover ArkTelos development. ArkTelos Lab publishes architecture analysis, experiments, and reproducible research.