← Abdelrahman Saed · All case studies
An open-source cached PDF viewer for Flutter, adopted across thousands of apps
Creator & maintainer · 2020 — Present · iOS · Android
Displaying remote PDFs in a mobile app sounds trivial until you ship it. The common approaches each fall short:
I kept solving the same problem across projects, so I built it once, properly, and open-sourced it.
flutter_cached_pdfview renders remote PDFs natively while caching each downloaded file on-device — so a document opens instantly and works offline on every load after the first.
It wraps the native flutter_pdfview renderer with flutter_cache_manager, and exposes one small, declarative API over three sources — URL, asset, and file path — with progress placeholders, error widgets, and password-protected and gesture-zoom support built in:
// First open downloads + caches; every later open is served from disk.
const PDF().cachedFromUrl(
'https://example.com/doc.pdf',
placeholder: (progress) => Center(
child: CircularProgressIndicator(value: progress / 100),
),
errorWidget: (error) => const Center(child: Text('Failed to load PDF')),
);
The goal was to make the right behavior — cached, offline-capable, native rendering — the default, in a few lines, on both platforms.
The package is a thin, deliberate composition rather than a reinvention:
flutter_pdfview, so documents look and scroll the way users expect on each OS, and the package stays small.flutter_cache_manager. Remote files are downloaded once and stored in a managed on-device cache; later reads resolve straight to a local file, which is what makes repeat opens instant and offline-safe.cachedFromUrl, fromAsset, and fromPath unify remote, bundled, and local documents behind one widget, so callers swap sources without touching their UI.placeholder (download progress) and errorWidget are part of the public surface, so loading and failure states are handled by design rather than bolted on.It supports Android API 20+ and iOS 11+, ships under the MIT license, and has stayed maintained since 2020.
The entire point of the package is performance and resilience under real-world conditions:
The package became one of the go-to PDF solutions in the Flutter ecosystem:
super.key, current cache-manager APIs).A small library with an outsized footprint: a focused tool that solved a recurring problem well enough that thousands of other apps now rely on it. The companion guide below walks through using it end-to-end.
Related reading: Building a Cached PDF Viewer in Flutter